AzeS Posted August 18, 2016 Share Posted August 18, 2016 So there are three major problems in my script securityi will do this by my self... so dont judge me for issues in this specific topic i just started this... upload dir won't work instead it drops the file in the main dir where the index lays... and names it with vid instead of putting it to the vid dir it cant upload videos somehow...i already changed the ini so that files in size of 1gb can be uploaded on to the server. there are no errors displayed: Code: Vidbase.php -> public function doupload ($UID,$TAGS,$VTITLE,$VDESCRIPTION,$VIDEO,$QUESTIONS,$GENRE) { $dir = "../../VID"; $fname = $VIDEO['name']; $ftmp = $VIDEO['tmp_name']; $ftype = $VIDEO['type']; $fsize = $VIDEO['size']; $ferr = $VIDEO['error']; $fname = preg_replace("/[^A-Z0-9._-]/i", "_", $fname); if (!$ftmp) { $fmsg = "Error: youve not choosen a file please do so in order t upload a file."; return $fmsg; } if ($ferr !== UPLOAD_ERR_OK) { $fmsg = "An error occurred"; return $fmsg; exit; } $i = 0; $parts = pathinfo($fname); while (file_exists($dir . $fname)) { $i++; $fname = $parts["filename"] . "-" . $i . "." . $parts["extension"]; } $success = move_uploaded_file($ftmp, $dir . $fname); if (!$success) { $fmsg = "upload failed"; return $fmsg; } chmod($dir . $fname, 0644); $fmsg = "upload complete"; return $fmsg; } upload.php <?php if (isset($_POST['submit'])) { $vid->doupload($userRow['userId'],null,"TITLE","DESCR",$_FILES['file'],null,"tech"); } ?> <form id="upload_form" enctype="multipart/form-data" method="post"> <input type="file" name="file" id="file1"><br> <button name="submit">UPLOAD</button> <progress id="progressBar" value="0" max="100" style="width:300px;"></progress> <h3 id="status"></h3> <p id="loaded_n_total"></p> </form> any sugestions ? Quote Link to comment https://forums.phpfreaks.com/topic/301937-video-upload-wont-work/ Share on other sites More sharing options...
Jacques1 Posted August 18, 2016 Share Posted August 18, 2016 Your upload directory path has no trailing slash, and you just append the filename. This will lead to a file with the name “VID...” rather than a file in the “VID” directory. And you indeed don't display any errors. You return a message in your function and don't do anything with it in your main script. Quote Link to comment https://forums.phpfreaks.com/topic/301937-video-upload-wont-work/#findComment-1536322 Share on other sites More sharing options...
AzeS Posted August 18, 2016 Author Share Posted August 18, 2016 yea i know its meant to be that way ill do this later... xD ive changed the dir var now and it works... but still i cant upload videos to my server Quote Link to comment https://forums.phpfreaks.com/topic/301937-video-upload-wont-work/#findComment-1536324 Share on other sites More sharing options...
Solution AzeS Posted August 18, 2016 Author Solution Share Posted August 18, 2016 (edited) Your upload directory path has no trailing slash, and you just append the filename. This will lead to a file with the name “VID...” rather than a file in the “VID” directory. And you indeed don't display any errors. You return a message in your function and don't do anything with it in your main script. --> changed dir var to ../../VID/ it works now needed to change the ini a little more... post_max_size upload_max_filesize memory_limit to 1000M thanks alot ! Edited August 18, 2016 by AzeS Quote Link to comment https://forums.phpfreaks.com/topic/301937-video-upload-wont-work/#findComment-1536325 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.