Add image to existing MySql record - php

I'm quite new to PHP and MYSQL.
I need to add an image to an existing record.
So I have a list of records and when I click the link directing to this page.
In this form I would like to ad an image.
Thanks in advance

I would highly discourge you from saving files in a database like that.
Here are the steps that I have used before:
I would create a folder on the server for each user.
Save the filename and extension in a table.
Save the file to the server folder.
If I wanted to grab a file I would go to the right directory and file name.
Examples:
Profile Picture = {userFiles/userID/filename}
Contract for Billy = {userFiles/{Billy'sID}/{filename}

Related

Uploading different file on different column of database table

I have employee form that I use to store employee full information including cv, contract papers, and other documents.
How can I upload these different files for one employee using php And mysqli?
Here what the table should look like:
Id name email resume(file) contract(file) edu_docs
I would highly discourge you from saving files in a database like that.
Here are the steps that I have used before:
I would create a folder on the server for each user.
Save the filename and extension in a table.
Save the file to the server.
If I wanted to grab a file I would go to the right directory and file name.
Examples:
Resume = {userFiles/userID/filename}
Contract for Billy = {userFiles/{Billy'sID}/{filename}

Preview saved image in database using PHP and jQuery

I have uploaded and stored multiple images at a time in a MySQL database using jQuery and PHP. This time I am storing image name in database and uploads file in a folder at server.
Now, I want to retrieve image name from database and preview this image and also want to provide actions of delete and add images.
Can anyone help me out on this issue?
Here is my steps:
Create a php file
Connect to mysql database
Select the table where the images was saved.
Loop the query.
Add delete query.
Hope this helps.

Codeigniter - Download a upload file in the directory

I'm using the latest Codeigniter version, and I write a program about basic file uploading and download helper in http://ellislab.com/codeigniter%20/user-guide/helpers/download_helper.html.
I want to create a system that will upload a multiple files to the directory and save the file name to the database and the name of the uploader, and will have function to have download links to download every file of that specific user. If possible the system can email the encrypted link to the users to download the file. And can only download for specific time..
I don't know the logic in dynamic files to download. Can someone teach how to do this or what logic can solve this problem. Thank you very much! :)
For multiple files you have some alternatives, you can create each field as a user press a button or use the multiple propriety to <input> tag.
To manage this multiple uploads you must create your own upload library reading each $_FILES['nameoffield'] in a foreach loop for example although there are alternatives ready to be used like: https://github.com/nicdev/CodeIgniter-Multiple-File-Upload
On your database, you could have two fields that stores the original file name and path, and the encrypted one. Probably associated to a random unique number or timestamp.
To email encrypted link, and by encrypted I think you are saying a disguised link to the file, not using original name, you simple select the field which store the encrypted name to a controller, like download and keep a variable to receive a value as parameter. This value you must check on database if it really exists and then redirect to the file. By doing that you should have your file being downloaded.

How to attach multiple pdfs from directory (in server) to email attachments in PHP

I made a form that can send form details to database then convert results to pdf (*pdfcrowd).
I have saved the filename(*of the pdf) inside the database and the pdf is saved inside a folder directory too.
Everything is working fine. EXCEPT that i'm stuck on how to get the pdf files.
The user is going to see the tables. I'll provide a checkbox and when the checkbox is clicked, the filename in the row should be included on what to attach in the email.
My database is Recipes, Table: Recipe_list, The field where filename is saved is.. "recipe_name" and the folder where the pdfs files are inside "/recipes/" folder.
I don't understand the "MIME" and other stuff about email attachment. I would appreciate if you can help me with this.
you can refer below link for this task,
http://www.emanueleferonato.com/2008/07/22/sending-email-with-multiple-attachments-with-php/
this would be very much helpful to you.
Thanks.

How to create user-accounts' separate folders to save user data in--PHP

How would I save each user's 'default photo' onto a website? This same photo may be used during some of their interactions on the site(maybe in a chat session), and it may be displayed on their profile page. Will each user have their own folder? If so, how can I create such a folder. Will this folder stay on ftp? Or MySQL? Will it take any space? As of now, whatever photos are uploaded onto the server, are simply stored in a folder that reads--'uploadportrait.php'. Where can I go from this? If someone can tell me the general principles of this, then that would be great! Thank you in advance.
If it is just one photo it doesn't make much sense to create a folder for each user. If you already have a working upload routine, simply store the file path of the uploaded file inside of the user database. You don't need to duplicate the image then.

Categories