d22552000 Posted October 7, 2007 Share Posted October 7, 2007 Is there a way to get information about a file BEFORE it is submitted to the server? I am trying to make a upload progress bar from scratch WITHOUT THE PRON.C PHP FIX!!! I found the file being uploaded in my NET://WINN01910//TEMP folder and I can outputs its file size in a popup with a one second refrehs, but this makes it so the USER needs to know the full file size to know if its anywehre near done. Is there a way to get the filesize from the clients side? Possibly javascript that uses ajax to submit the values to the server before the file is sent but when it is selected?? Is there an easier way to do this and/or do you have any ajax example code of how it might work? I also have another problem, Althoguh i can echo the filesize of what is recieved so far, I am just glob()ing the temp folder for: "php*.tmp" but is there a way to tell the tmp file so they don't see everyone's uploads? Quote Link to comment Share on other sites More sharing options...
d22552000 Posted October 7, 2007 Author Share Posted October 7, 2007 I am trying a few js based ones: function imgLoad() { var strT = new String(); document.getElementById("ShowImg").innerHTML= ""; strT = document.ModReg.file1.value; if(strT != "") { strT = "<img id='Sample' src='" + strT + "' width='100' height='100'></img>"; document.getElementById("ShowImg").innerHTML= strT; if(!LimitedSize()) { alert("File Size is more than 100 KB"); document.getElementById("ShowImg").innerHTML= ""; } } } function LimitedSize() { var i; var y = document.images; for (i=0;i<y.length;i++) { if((y[i].id) == 'Sample') { if(y[i].fileSize > 102400) return false; } } return true; } //--------------HTML <INPUT name=file1 type=file id="file1" onChange="imgLoad()" > I am not sure about it though, it works, but VERY badly. Please can anyone help? Quote Link to comment Share on other sites More sharing options...
Fadion Posted October 8, 2007 Share Posted October 8, 2007 No need to fix/patch/whatever the php install. U can do it combining php with perl and megaupload script is an example. Ive seen u work on projects like 'a web server' so probably it would be nosense saying why are u creating this when it is there. Its always better to create your stuff, but in this case (and mostly in the 'web server' thing) it means reinventing the wheel . Oh good luck by the way. Quote Link to comment Share on other sites More sharing options...
d22552000 Posted October 8, 2007 Author Share Posted October 8, 2007 hey, I HAVE made my own webserver and it works on windows, I am just trying to get chmodding to work under linux and then its perfect :D I tried the mega upload php file upload, but it gives INTERNAL SERVER ERROR 500 on teh cgi script.. No info in the log file for cgi though... wtf/. THE FUNNY Part is that their online demo returns 500, so this means their code sucks... Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, raditha@raditha.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. -------------------------------------------------------------------------------- Apache/2.0.52 (CentOS) Server at www.raditha.com Port 80 hahah idiots Quote Link to comment 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.