image upload, resize THEN submit form
Posted on
16th Feb 2014 07:03 pm by
admin
Ok so I have a form that requires the user to upload an image, and then do something with that image (using some ajax scripts), then fill out the rest of the form and submit. I have the upload script pretty much working, my problem is that I need to store the uploaded images temporarily just in case the user decides not to submit the form
Here's the process I would need:
1) Form loads
2) User fills out form
3) User uploads image (php + ajax)
a) image is resized to a large and thumbnail image using imagecopyresampled()
b) fullsize and thumbnail images should be stored in a temporary location ??
4) Image is dynamically displayed in the form after upload and resize (using some jQuery/ajax magic)
5) User performs some action to the uploaded image (using jQuery/ajax)
At this point, the user can submit the completed form, at which time a php script will will move the temporary (resized) fullsize and thumbnail images from the temp location to a permanent location on the server, and if the file saving succeeds, then it will write the form data to a MySQL server.
BUT if the user doesn't submit the form, I need the temporary files to be deleted.
Normally this would be handled by the temporary files being stored by the $_FILES array, but since I have to resize them after upload, the $_FILES["upload"]["tmp_name"] is automatically deleted after I resize it.
Please suggest an alternative solution. As I said, the upload script is done. It can upload and resize the images, but I need a way to store the images temporarily until the form is submitted.
No comments posted yet
Your Answer:
Login to answer
163
37
Other forums
Month String to Numeric?
Hi guys,
Given a month as a string, is there a simple way to find the numeric representation
How to ask a regex question?
Hi, I thought I'd share some of my insight after seeing too many bad questions that either get ignor
calendar dates and hours compare problem
i have a calendar in wordpress, everything works great except that i can make 2 meetings at the same
I need help on this PHP code
Hi everybody, I made some kind of mistake while editing the code below. As you see, at the 3 row my
extract data
Code: <div class="post hentry uncustomized-post-template">
DateObject and Nulls
Hi all,
I have an array mapped to a value object. One of the items in the array is a PHP Date
classic dynpro : hide area and auto adjust hights
Hi,
I want to develop a similar user interface as is used in standard transaction MIGO.
PHP / MySQL Associative Multidimensional Array:
Hello.
I have data in a MySQL Table that adheres to the below: (note, no index, could add if
array_combine() trouble w/csv file
I have a problem with a piece of code I wrote to import some records from a csv file into mysql. I h
present value of sequence?
Hi
Please help me to find out the present value of sequence?
Thanks