Hi all
I'm a bit of a php mysql newbie and lately I've been slowly building a site designed to be a list of all the work my company has done and provide download links to a file associated with that particular job. I have everything working finally except one little part. The file upload section.
I previously had it set up so that I had a page where you selected a file and it would upload the file to the server by making an FTP connection. However for some reason if the file was over 2 megabytes in size it would fail the upload while any file below that size would upload fine (does anybody have any idea why this would happen).
I then decided to take a different route. I would upload the file using a standard ftp client and then on my upload page I would change it so that you select a file and it would read the filename and pass it onto the next page via a session variable.
The problem I am having is that when I select the file and click on the submit button it seems to be uploading the file into memory before it can read the filename and this can be taking a while on larger files. I'd like to simply select the file and click submit and have it read the filename and remove the extra path information. The code I'm using is as follows:
if(isset($_POST['SubmitFile'])){
$_SESSION['filename'] = "";
$myFile = $_FILES['txt_file']; // This will make an array out of the file information that was stored.
$file = $myFile['tmp_name']; //Converts the array into a new string containing the path name on the server where your file is.
$myFileName = basename($_POST['txt_fileName']); //Retrieve filename out of file path
$destination_file = "/htdocs/CMS/files/".$myFileName;
$_SESSION['filename'] = $myFileName;
header('Location: newSite.php');
}
Any help would be greatly appreciated
Thanks
Dave