calmchess Posted April 23, 2009 Share Posted April 23, 2009 How do i determine that a file has been fully uploaded ? I want to create and if statement that says if this file has been uploaded then set a session Variable. Link to comment https://forums.phpfreaks.com/topic/155400-file-upload-if-file-uploaded-statement/ Share on other sites More sharing options...
Zhadus Posted April 23, 2009 Share Posted April 23, 2009 It depends on how you're doing the upload. If you're using a "move" command to a permanent folder after it loads to the temporary, it will return false if it fails, so you can use an if statement on the command itself. Otherwise run a file_exists() at the target location to see if it was uploaded or not. Link to comment https://forums.phpfreaks.com/topic/155400-file-upload-if-file-uploaded-statement/#findComment-817686 Share on other sites More sharing options...
calmchess Posted April 23, 2009 Author Share Posted April 23, 2009 how does this look>? $newname = uniqid("leg").$type1; if(move_uploaded_file($_FILES['mailfile']['tmp_name'], "../legalstorage/$getn/$newname")){ $_SESSION['setform']=true; $_SESSION['pic']= 0; header('Location: http://privatechatnow.com/currentwebsite/activation/upage.php?id='.$id); }else{ $_SESSION['setform']=true; $_SESSION['pic']= 1; header('Location: http://privatechatnow.com/currentwebsite/activation/upage.php?id='.$id); } Link to comment https://forums.phpfreaks.com/topic/155400-file-upload-if-file-uploaded-statement/#findComment-817700 Share on other sites More sharing options...
Zhadus Posted April 23, 2009 Share Posted April 23, 2009 Doesn't matter how it looks, just if it works. But that will run the "else" portion of the statement if it doesn't upload properly if that is what you're checking for. Link to comment https://forums.phpfreaks.com/topic/155400-file-upload-if-file-uploaded-statement/#findComment-817718 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.