Ok, I can manage to throw around a file thats already on a web server with PHP, but how do I get the program to that location on the webserver? Theres gotta be some php code to do that, right?
Printable View
Ok, I can manage to throw around a file thats already on a web server with PHP, but how do I get the program to that location on the webserver? Theres gotta be some php code to do that, right?
found it in the documentation, for anybody who needs to reference this, it worked fine for me.
http://www.php.net/manual/en/features.file-upload.php
heres how the code looked
<?
$uploaddir = "X:\\whateverdir;
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir .".txt"))
{
print "File is valid, and was successfully uploaded!<br><br>";
}
else
{
print "Possible file upload attack! Here's some debugging info:<br><br>print_r($_FILES)";
}
how can you throw around a file on the webserver if it is already there in php?
What? You do realize that you're not making much sense these days...?Quote:
Originally posted by phpman
how can you throw around a file on the webserver if it is already there in php?
yup, old age :p
let me rephrase that
how can you throw around a file on the webserver if it is already there, by using php?
Haha, you're still not making sense to me. Maybe I don't understand the concept of 'throwing a file around.'Quote:
Originally posted by phpman
yup, old age :p
let me rephrase that
how can you throw around a file on the webserver if it is already there, by using php?
I thought he just meant he could move a file around, but wanted to know how to get the file to the server in the first place.
Color me confused, though.
hehe that was my impression.
if the file is already there on the server how can he move it around using php? open it up and save it to another folder than delete the old one?
as far as I know there isn't a function to do that. but I have been blind before :D
Sorry I haven't check this thread in awhile...
basically The Hobo was right on. I know how to copy, move, delete, read from, etc etc, a file thats on my server but getting it to my server to play around with was the issue. Heres some file functions from php.net
http://www.php.net/manual/en/function.copy.php
actually thats just the copy function but all the other functions are listed along the left side. I love the way php.net list all the functions and handles documentation.
Have fun.
:cool:
The downloadable .chm is even better :)Quote:
Originally posted by TheGoldenShogun
actually thats just the copy function but all the other functions are listed along the left side. I love the way php.net list all the functions and handles documentation.
would you please explain to me how you move a file that is already on the server using php?Quote:
Originally posted by TheGoldenShogun
Sorry I haven't check this thread in awhile...
basically The Hobo was right on. I know how to copy, move, delete, read from, etc etc, a file thats on my server but getting it to my server to play around with was the issue. Heres some file functions from php.net
http://www.php.net/manual/en/function.copy.php
actually thats just the copy function but all the other functions are listed along the left side. I love the way php.net list all the functions and handles documentation.
Have fun.
:cool:
from my program, heres an example
function copy_main_file()
{
copy("G:\\PROGRAMS\\UPLOADS\\uploaded_file.tmp", "G:\\PROGRAMS\\SYS\\".$date_name.".tmp");
if (file_exists("G:\\PROGRAMS\\SYS\\".$date_name.".tmp"))
{
echo "Backup of the Uploaded file has been successfully saved..<br>";
}
}
well duh, I always thought copy was for uploads. just one of those things. :)
I think there is a specific function for that, so you're not completely crazy. :)Quote:
Originally posted by phpman
well duh, I always thought copy was for uploads. just one of those things. :)
well yeah, move_uploaded_file() but I don't like that one and always use copy()