How to edit uploaded multiple file input partially? - php

I want to edit already uploaded multiple files.
I use jquery plugin to upload files.
I created a form and used jquery filer plugin to upload multiple files.
Added php code in backend to upload them to server and the urls into array saved in database.
I can preload the uploaded files to jquery filer with file option.
I can delete the uploaded file with ondelete option.
Now I want to delete some files add upload some files and then create a new array containing the new set of files to save in database.
I am a beginner. I don't have any ideas and I already searched whole of the internet.

Related

Plupload Image Upload preload images OR add images programmatically

I am using Plupload to allow users to upload images in a form. I am able to successfully upload images using Plupload. My program also allows users to save the form and continue editing/posting later. Now when the user resumes the form later I want to pre-load those files in Plupload from the server. I am not sure how to implement this.
I have been trying to implement addFile, but cannot implement. I would like to preload or add files to plupload programmatically.
Link:
Add File Method
Your help would be appreciated!

File remove from selected files while multiple file upload in php

Is there any process to remove file content while files are selected for upload using multiple file upload and update form after remove file to send data another php page with ajax call function. I am novice in file multiple file handling.
if i understand your requirement - you cant change anything in file ( image ) before uploading to server.PHP works on server not on client side OR Please explain your requirements.

ajax upload image and send data

I have html form with lot of textboxes, and three optional image uploads.
How can I make ajax:
1) Saves the pictures in the server folder [example: ./MyImages]
2) When pictures are saved, their URL's and all other textbox data is saved to mysql.
thank you
You can use Ajax Form to post the data and the files using ajax.
Then in your php file you can save the images into a directory, see : move uploaded file then save the file names to your db.
So you can reach the url's using your website url, directory name and file name.

Browse directory files and pass url to PHP, or upload and pass URL

I've been searching for a good 3 hours, and I'm stumped on how to do something I think is pretty simple (famous last words...)
Basically, I'm building a site that allows the user to upload a pdf file. The URL of this file is stored in a database, along with the name and a few other details. I am trying to work out how to either:
-Provide an "upload" box/button/area that a user can select a file, upload it, and then have the URL of where the file was uploaded stored in a database.
OR
-Use a separate upload script, and have the user upload the file. Then, (on a possibly separate page, I don't mind) provide a file browser, which would allow the user to browse a directory, and select a file, with the url of that file passed through to the PHP form.
I don't mind which way it is done, as long as the desired outcome of having a file uploaded and the url added to a database.
Or am I out of the reach of PHP? Is my best bet uploading files via a bare php uploader, then manually entering the url of the file uploaded into a textbox on a php form?
Any help is much appreciated!
create a htmlform, make sure to set enctype to a value of
"multipart/form-data"
in PHP you should be able to get the file namefrom the $_FILE global variable
save it to a directory on the server.
the url of your document will we http://serverroot/{directory name}/filename.pdf -> directory name is the name of the directory on the serve you saved the file in

How do I retain uploaded files after POsting a form with a file upload?

Is it possible to retain an uploaded file after it has been uploaded?
I'm building a email composer application. Users can upload files as attachments. At times out of 10 uploaded files one of them isn't uploaded correctly, or the submitted form is invalid. Then the compose page would be displayed again. However, the user would need to upload the file again this time. Is it possible to somehow maintain the uploaded files somewhere on the first upload, and if the form is invalid, then display links to the file uploaded or so?
Yes, just copy the files to an temporary folder and display the files as list which have been successfully uploaded. Then store the filenames inside hidden input fields (for example) and when the user submits the form again, you will be able to upload the new files and also retrieve the files that were uploaded previously.
Some pseudoish code:
/*
If $_POST request
Loop through every file uploaded ($_FILES)
Check for errors
Save the file into a temporary directory
Build an array of files successfully uploaded
Loop through previously uploaded files ($_POST['uploaded'])
Append the filenames to the array of uploaded files
Validate the rest of the form
If no errors
Move files from temporary location to the actual location
Else
Show the same form
Print the filenames inside hidden input fields
<input type="hidden" name="uploaded[]" value="filename.txt" />
Show the user the list of files and allow deletion of files
Rinse and repeat
*/

Categories