upload a file

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
micknic
Forum Commoner
Posts: 37
Joined: Thu Feb 27, 2003 1:27 pm
Location: belgium

upload a file

Post by micknic »

I would like to give the opportunity to my websites users to upload files on the server. Is this the good syntax??

<html>
<head>
<title>Chargement de fichier</title>
</head>
<body>
<H3>Cette page vous permet d'envoyer un fichier sur le serveur</H3>
<form action="upload.php" enctype="multipart"/form-data" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="1024"/>
Charger le fichier: <input name="fichier" type="file" /><br />
<input type="submit" value="GO >>">
</form>
</body>
</html>

do I have to use move_uploaded_file after?? I think this syntax change the name of the file. Is it true??? If yes how to keep the real name of the file?????
User avatar
daven
Forum Contributor
Posts: 332
Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:

Post by daven »

viewtopic.php?t=6435

Code/discussion about file uploading scripts

Your code seems to be decent for the client side. The processing stuff is entirely separate.
micknic
Forum Commoner
Posts: 37
Joined: Thu Feb 27, 2003 1:27 pm
Location: belgium

Post by micknic »

Hi daven

You gave me many advices today and i would like to thank you. I looked the link you wrote.
If i understand well with the code of the men you helped the name of the uploaded file keep his temporary name?!?!

and what about the downloading of files?

For the end of the day you are going to hate me :wink:
Coco
Forum Contributor
Posts: 339
Joined: Sat Sep 07, 2002 5:28 am
Location: Leeds, UK
Contact:

Post by Coco »

so far as i know, the file is saved to a temp dir with its origional name. Obviously you dont want to leave it there, so you should copy it to somewhere else.
If i understand it right $userfile is the name of the file.
Post Reply