Jump to content

Upload a file to server?


TeddyKrulewich

Recommended Posts

I am learning php, and i know flash, javascript,html,C++, SOME python. Anyway, I was following the tutoirals on this site and I got to teh upload file tutoiral. When I uploaded the php files and tested them, it seems to work fine but I used fireftp to look at my site and i dont see any files.

Link to comment
Share on other sites

just to let you know. The php file is www.teddykrulewich.com/Untitled-1.phpEDIT:It still doesnt work. Itried the code from that web site(which is a little different) and it says:Possible file upload attack!Here is some more debugging info:Array( [userfile] => Array ( [name] => mozilla.gif [type] => image/gif [tmp_name] => /tmp/phpAvS9fr [error] => 0 => 12859 ))

Link to comment
Share on other sites

Then the call to move_uploaded_file is failing. From experience, most of the problems with move_uploaded_file are due to permissions. Print out the path you are trying to move the file to, make sure it exists and is a valid path, and make sure you have write permission on the directory.The file did upload successfully, because the error code in the file array is 0. It is most likely a permission issue.The other issue may be that the file does not exist, but you can use is_uploaded_file to check for that beforehand and make sure that it exists before you try to move it. In fact, you should use is_uploaded_file to make sure someone is not trying to hack the server by giving a system file name as the uploaded file.http://www.php.net/manual/en/function.is-uploaded-file.php

Link to comment
Share on other sites

You should be able to see in the FTP program what the permissions are on the folder. Depending on the operating system of the server and the FTP client you are using, they might look like this:drwxr-xr-xThe 'd' indicates 'directory', and then there are three sets of three RWX fields. RWX are read, write, and execute. The first group of three is for the owner, the second group of three is for the owner's group, and the third is for everyone else. In the example above, the owner has read, write, and execute, the owner's group has read and execute, and everyone else has read and execute also.You can also use the chmod function in PHP to change permissions on a directory or file. But it's not a good idea to give everyone write access if you can avoid that.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...