PDA

View Full Version : Preview Images before upload and upload all images at once



raj_2006
03-14-2007, 06:26 AM
Hi All,

I dont have much idea about javascript and thats why again I am here...:)

I am trying to do a picture gallery like this.

I have 1 <input type=file name=file> inside a form tag.

I have 8 <td>s below where 8 images can be shown up with a delete button for 8 images.That means the user can upload upto 8 imgs one by one via that single input file.Now lets say I have selected 1 image and that image will be displayed on 1st box.....next select 2nd image and that image will also be shown up in the 2nd box.....Now I have delete button below every box...so if i want then i can delete any image before upload.

First I would like to know

1.is it possible to upload more than one image via single input(one by one)...if so then i think i have to keep the filenames in a array.

2.if the selected filenames are in array then how could i post that array via form (I am using php as a serverside language)

Please direct me in a right direction so that it works.......thanks all of you for your earnest contribution in advance.

Luv
Raj.

thetestingsite
03-15-2007, 02:37 AM
Not sure if this could be done simply using javascript.

1 - You would have to use some sort of server-side language to upload the images (even in a temporary state).

2 (outside of the javascript item) - You would not be able to use just one file element (in the form) for the upload of mulitple items; unless you uploaded the items one at a time (then you could use hidden fields to upload mulitple items).

Either way, hope this helps.

raj_2006
03-15-2007, 09:11 AM
Hi

Thanks for your post.


1 - You would have to use some sort of server-side language to upload the images (even in a temporary state).

yes i am using php


2 (outside of the javascript item) - You would not be able to use just one file element (in the form) for the upload of mulitple items; unless you uploaded the items one at a time (then you could use hidden fields to upload mulitple items).

regarding this one I have one url where i saw how the multiple images are uploading.But failed while trying to display the images before the final submit button is clicked.

here is the url:

http://the-stickman.com/web-development/javascript/upload-multiple-files-with-a-single-file-element/