Re: PHP File Uplaod Path

From: Date: Thu, 08 Feb 2001 15:32:38 +0000
Subject: Re: PHP File Uplaod Path
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-38765@lists.php.net to get a copy of this message
Dhaval, You really do not nee to be concerned about the temp directory, but if you are, you can wite a little script (if your not the sysadmin) to find this out. Actually it tells you a ton of useful info. Here it is: <? phpinfo(); ?> Name it phpinfo.php or whatever you like, upload it to the server and view it. I believe that PHP knows where to look to find the temp file. As far as moving the file once its uploaded, here you go: File to create the upload: (show_upload.php) <html> <head> <title>Upload a File</title> </head> <body> <h1>Upload a File</h1> <form enctype="multipart/form-data" method="post" action="do_upload.php"> <p><strong>File to Upload:</strong><br> <input type="file" name="img1" size="30"></p> <P><input type="submit" name="submit" value="Upload File"></p> </form> </body> </html> File to do the work: (do_upload.php) <? if ($img1_name != "") { copy("$img1", "/your/directory/path/$img1_name") or die("Couldn't copy the file!"); } else { die("No input file specified"); } ?> <html> <head> <title>Successful File Upload!</title> <body> <h1>Success!</h1> <P>You sent: <? echo "$img1_name"; ?>, a <? echo "$img1_size"; ?> byte file with a mime type of <? echo "$img1_type"; ?>.</p> </body> </html> This is taken from Julie Meloni's website. She writes GREAT books. "PHP Essentials" is essential. http://www.thickbook.com/extra/php_fileupload.phtml Thanks Julie!!! - Shane DISCLAIMER: I am by no means an expert on this, or any other, topic... ----- Original Message ----- From: "Dhaval Desai" <dhaval_adams@yahoo.com> To: <php-general@lists.php.net> Sent: Wednesday, February 07, 2001 3:42 AM Subject: [PHP] PHP File Uplaod Path > Hi! > > I need help with uploading files with php. > What is the default directory where the files are > uploaded..? > I want to specify a particular directory where the > files have to come after they are uploaded. > > Is it possible to specify a path in the script where > the files will automatically be copied after uploading > to the temporary directory. > > Please help me out ... > > Thank You > Dhaval Desai > > > > > __________________________________________________ > Do You Yahoo!? > Yahoo! Auctions - Buy the things you want at great prices. > http://auctions.yahoo.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#38765) next »