RE: [users@httpd] Upload files to local directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: kartikay malhotra [mailto:kartikay.malhotra@xxxxxxxxx] 
> Sent: Wednesday, May 17, 2006 4:05 PM
> To: users@xxxxxxxxxxxxxxxx
> Subject: [users@httpd] Upload files to local directory
> 
> Hi everyone!
> 
> I'm a linux user. I want to upload files to my Apache HTTP 
> server. I have a MySQL database in place. But prior to that I 
> wish to save uploaded files in a temporary folder. 
> 
> I've used PHP scripts with HTTP POST method. But to no avail. 
> No matter what tutorial I consult, I cannot save the uploaded file. 

More of a PHP problem than apache, but.....

This is most probably a permissions problem - does the apache user (see
directive "User") have write privilege in the target folder?

If you check the error_log you might find something helpful..

Rgds,
Owen Boyle
Disclaimer: Any disclaimer attached to this message may be ignored. 


> 
> 1. What could I be doing wrong?
> 
> My file for reference:
> 
> <html>
> <head>
> <title>Upload File To MySQL Database</title>
> <meta http-equiv="Content-Type" content="text/html; 
> charset=iso-8859-1">
> <style type="text/css">
> </style>
> </head> 
> 
> <body>
> <?php
> if(isset($_POST['upload']))
> {
> $_FILES['userfile']['name']='/usr/share/wallpapers/Circuit.jpg'; 
> 
>         $fileName = $_FILES['userfile']['name'];
>         $tmpName  = $_FILES['userfile']['tmp_name'];
>         $fileSize = $_FILES['userfile']['size'];
>         $fileType = $_FILES['userfile']['type'];
> 
>         echo $fileName;
>         echo "<br>";
>         echo $tmpName;
>         echo "<br>";
>         echo $fileSize;
>         echo "<br>"; 
> 
>         $target_path = "/var/www/html/"; 
> 
>         $target_path = $target_path . basename( 
> $_FILES['uploadedfile']['name']);
> 
>          if(move_uploaded_file($tmpName, $target_path)) {
>             echo "The file ". basename( $fileName). " has 
> been uploaded";
>          }
>          else{
>              echo "There was an error uploading the file, 
> please try again!"; 
>          }
> }
> ?>
> 
> <form action="" method="post" enctype="multipart/form-data" 
> name="uploadform">
>   <table width="350" border="0" cellpadding="1" 
> cellspacing="1" class="box"> 
>     <tr>
>       <td width="246"><input type="hidden" name="65536" 
> value="2000000"><input name="userfile" type="file" 
> class="box" id="userfile"> 
>          </td>
>       <td width="80"><input name="upload" type="submit" 
> class="box" id="upload" value="  Upload  "></td> 
>     </tr>
>   </table>
> </form>
> </body> 
> </html>
> 
> Sample output:
> /usr/share/wallpapers/Circuit.jpg
> /tmp/php8YIDF9
> 4376
> There was an error uploading the file, please try again! 
> 
> Please help!!
> Many Thanks
> KM
> 
>
 
 
This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please notify the sender urgently and then immediately delete the message and any copies of it from your system. Please also immediately destroy any hardcopies of the message. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. The sender's company reserves the right to monitor all e-mail communications through their networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of the sender's company.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux