file upload issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

file upload issue

Post 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.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Yep, not possible...think of the secuirty implications!!!!!
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post 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 .
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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" />
Post Reply