c_shelswell Posted December 6, 2006 Share Posted December 6, 2006 Whats the best way to do this? :I need to make a page that will allow someone to upload a large file to a server. I need to use ftp to do this as the filesize will be much larger than my hosts php setting will allow. I'm trying to use this:[code]<form enctype="multipart/form-data" method="post" action="include/my_ftp.php"><input name="file" type="file" size="40"><input type="submit" name="upload" value="Upload">[/code] to browse and select a file to upload the thing is the method to upload on my other page requires the full file path[code]if (isset($_POST['upload'])){ $file = ($_FILES['file']['name']); putFile($file); }} }function putFile($file){ $conn = DoConn(); if (ftp_put($conn, "/www/images/name.gif", $file, FTP_BINARY)) { echo 'yes'; } else { echo 'nope'; }}[/code]as far as i can find out the $_FILES variable won't ever get the full file name. Is there a way of doing this? or even a better way of trying to do what i'm after.Thanks Link to comment https://forums.phpfreaks.com/topic/29657-file-uploads-need-the-full-file-path/ Share on other sites More sharing options...
papaface Posted December 6, 2006 Share Posted December 6, 2006 Im pretty sure you need to put[code]function putFile($file){ $conn = DoConn(); if (ftp_put($conn, "/www/images/name.gif", $file, FTP_BINARY)) { echo 'yes'; } else { echo 'nope'; }[/code]Before[code] putFile($file);[/code]As it is trying to find something it hasnt read yet.... Link to comment https://forums.phpfreaks.com/topic/29657-file-uploads-need-the-full-file-path/#findComment-136110 Share on other sites More sharing options...
c_shelswell Posted December 6, 2006 Author Share Posted December 6, 2006 no thats not the problem. putFile() is a function that's being called it won't do anything till i call it. The problem is not having the correct file name for it.cheers Link to comment https://forums.phpfreaks.com/topic/29657-file-uploads-need-the-full-file-path/#findComment-136113 Share on other sites More sharing options...
c_shelswell Posted December 6, 2006 Author Share Posted December 6, 2006 sorry - still stuck on this. Any clues?bump Link to comment https://forums.phpfreaks.com/topic/29657-file-uploads-need-the-full-file-path/#findComment-136324 Share on other sites More sharing options...
papaface Posted December 6, 2006 Share Posted December 6, 2006 You have:[code]function putFile($file){ $conn = DoConn(); if (ftp_put($conn, "/www/images/name.gif", $file, FTP_BINARY)) { echo 'yes'; } else { echo 'nope'; }[/code]I think it should be[code]function putFile($file){ $ftp_server = "domain.com";//This is the domain you want to FTP to. $conn = ftp_connect($ftp_server); if (ftp_put($conn, "/www/images/name.gif" , $file, FTP_BINARY)) { echo 'yes'; } else { echo 'nope'; }[/code] Link to comment https://forums.phpfreaks.com/topic/29657-file-uploads-need-the-full-file-path/#findComment-136329 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.