Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File upload POST Method... 3

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi, I would like to build an image gallery which enables the users to upload their pictures but,my web hosting provider has disabled the "file_uploads" option. Is there still anyway to upload file other than using ftp? Or does anyone know more about upload using java applet? Thank you very much.
 
If you can't upload files with PHP, you have to use FTP to do it. A Java applet would have to use FTP too, though you could make the frontend and make the FTP access almost invisible to the user. //Daniel
 
Sorry I know nothing about ftp upload, do you mean I have to create a form like <form action =....enctype=..></form> and the submit button as well in order for the users to get their pictures uploaded? Thank you.
 
Most browsers have support for FTP these days, so you would have to create a link to ftp://anonymous@yoursite/ and have them copy their files on to the server. You would have to setup the FTP server to let the anonymous user to upload though, maybe just to a specific directory. //Daniel
 
My hosting company has the php file upload disabled as well. I used this - seems to work fine:


<HTML>
<TITLE>
File upload
</title>
<body>
<B>File upload</b>
<form enctype=&quot;multipart/form-data&quot; action=&quot;<?PHP echo $PHP_SELF ?>&quot;
method=&quot;post&quot;>
<input type=&quot;hidden&quot; name=&quot;MAX_FILE_SIZE&quot; value=&quot;1000000&quot;>
Send this file:
<input name=&quot;userfile&quot; type=&quot;file&quot;>
<input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Send File&quot;>
</form>
<br>
</body>
<?PHP

// copy to this directory
$dir=&quot;./put_name_of_directory_you_create_to_store_the_uploads/&quot;;

// copy the file to the server
if (isset($submit)){

if (!is_uploaded_file ($userfile)){

echo &quot;<b>$userfile_name</b> couldn't be copied !!&quot;;
}

// check whether it has been uploaded
if (is_uploaded_file ($userfile)){
move_uploaded_file($userfile,$dir.$userfile_name) ;}

echo &quot;<b>$userfile_name</b> copied succesfully !!&quot;;
}

?>
</html>
 
Warning: Unable to create '/home/.../images/news/A_J.jpg': Permission denied in /home/.../news1admin.php on line 18

Warning: Unable to move '/tmp/phpll3gzk' to '/home/.../images/news/A_J.jpg' in /home/.../news1admin.php on line 18

I'm really stumped I tried the code above and get these errors. Has my host disabled something? or is a folder setting on the server incorrect?

Here is the line that errors out:

move_uploaded_file($userfile,$dir.$userfile_name) ; -Pete[noevil]
 
Does the webserver user (usually [tt]apache[/tt] or [tt]httpd[/tt]) have the rights to write to the directory? You could easily test this by setting the permissions to 777, read-write-execute for all. //Daniel
 
using DiamongLil script, i can select (w/the Browse button) a file on my win98 machine to upload to my local Red Hat 7.3 server (Server A) where my PHP and Apache reside.

Now, i have a .gz file on my local Redhat server (Server A) which i want to upload to my remote REdhat server (SErver B) to be triggered from my win98 PC? How do i do that?

Is it possible to automatically point my upload script to the .gz file, that is, the user could not select/browse any other file but just click on the Send File button?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top