Page 1 of 1

file upload issue

Posted: Thu Oct 05, 2006 5:35 am
by itsmani1
I have multiple files to upload and paths are saved in hidden fieds instead of file field.
like this. I want to upload files.

Code: Select all

<form action="file.php" method="post" enctype="multipart/form-data" name="form1">
  <input type="submit" name="Submit" value="Submit">
  <input name="textfield" type="hidden="C:/Documents and Settings/Administrator/My Documents/My Pictures/ScreenShot_version_4_0.gif">
  <input name="textfield" type="hidden="C:/Documents and Settings/Administrator/My Documents/My Pictures/Screen.gif">

</form>
can anyone help me.

thanks much.

Posted: Thu Oct 05, 2006 5:46 am
by volka
The client has to upload the files; php has nothing to do with it.
And standard browsers will not consider any path given neither as default value for input/file nor as input/hidden.

Posted: Thu Oct 05, 2006 5:56 am
by JayBird
Yep, not possible...think of the secuirty implications!!!!!

Posted: Thu Oct 05, 2006 6:12 am
by itsmani1
my question is while uploading images i just use :

$_FILES['file']['tmp_name']

and get the image and in this way i am not using file type and using hidden .

Posted: Thu Oct 05, 2006 6:21 am
by volka
And therefore the client will not upload any filedata. And therefore php will get no filedata.
Client send the value of an input/hidden as name=value string pair. According to your form's method this name=value pair will be represented by $_POST['textfield'] in php. If you want multiple input/hidden fields with the same name use name="textfield[]". $_POST['textfield'] wll be an array with the values of all name="textfield[]"-elements sent by the client.

btw: not type=hidden=whatever but

Code: Select all

<input name="textfield" type="hidden" value="C:/Documents and Settings/Administrator/My Documents/My Pictures/ScreenShot_version_4_0.gif" />