Jump to content

akshay

Members
  • Posts

    50
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

akshay's Achievements

Member

Member (2/5)

0

Reputation

  1. Oh, good point. But before I noticed when max_execution_time was set to 1000 sec. The Connection would give a "Connection Reset" error. Since I've set it to 172000 (2days), it works fine. My host reported they made some changes and asked me to confirm. You think it can be because my host actually "fixed" something on server? Or, it's coz of newly changed PHP values (by me)? Please be sure. Thank you.
  2. In addition, I donot want to see any "Connection Reset" error that may occur occasionally. Thank you.
  3. Hello. My script is set to upload files upto 5GB large. For that script I've currently set memory_limit to 5GB. Is it alright? I mean what is the ideal value (for large upload scripts) If you feel, 5GB is large. I can make script to upload 2GB files and set memory_limit accordingly. Also, max_execution_time has been set by me to 86400 currently. Assuming, on a 500Kbps broadband, it would require upto 24 hours to upload a 3-5GB file. Please suggest. Thank you.
  4. Hello. I'm using a php script to upload file. I've used an iframe inserted on the upload page that refreshes every second/3sec. to display percentage uploaded. forget percentage, lets take a simple example. Presently, my iframe displays last two digits of PHP time() function that change constantly. If you see the live example at: http://mintload.com/upload/upload-single.php The last two digits of time() function are shown and iframe is refreshed every 1 sec. But, the moment one clicks "Upload" button, the file starts uploading, but iframe no more refreshes & freezes. In IE7 it works fine. Why not in Firefox Latest Ver: 3.6 ? code for iframe: header("refresh:1; $_SERVER[php_SELF]"); echo substr(time(),-2,2); My point is, just as in IE, my iframe shouldnt freeze refreshing even if a file is being uploaded. Any code/functions? The problem is taking place in Firefox. Please help. Thank you.
  5. Hello. I'm using a PHP/CGI Upload Script -tesUpload. U can see the uploader at http://www.mintload.com/upload/upload-single.php As you can see, the percentage doesnt reload (its an iframe). On Firefox, if u right click on frame (0%) and select "open frame in new tab" or show only frame, u see it movin' and refreshing. Basically the iframe /fileprog.php calculates the percentage uploaded and refreshes itself to get new percentage every second. The code for upload-single.php is : <?php require_once("upload_helper.php"); $sid = md5(uniqid(rand())); ?> <html> <head> <script language="javascript" type="text/javascript" src="upload.js"></script> <link rel="stylesheet" href="upload.css" type="text/css" media="screen" title="Upload" charset="utf-8" /> <script language="javascript"> function beginUpload(sid) { document.postform.submit(); var pb = document.getElementById("progress"); pb.parentNode.parentNode.style.display='block'; new ProgressTracker(sid,{ progressBar: pb, onFailure: function(msg) { Element.hide(pb.parentNode); alert(msg); } }); } </script> </head> <body> <form target="_top" enctype="multipart/form-data" name="postform" action="/cgi-bin/upload.cgi?sid=<?php echo $sid; ?>&target=<?php echo normal_target('receive.php') ?>" method="post"> <div class="inputhead">File 1</div> <input type="file" size="50" name="file_1" /><br/> </form> <div id="progressbox" style="display: none;"><img src="http://www.remit2home.com/remittance/images/mmm_loading.gif" alt="uploading..."> Uploading now... <div class="progresscontainer"><div class="progressbar" id="progress"></div></div> </div> <iframe src="http://mintload.com/upload/fileprog.php?sid=<?php echo $sid; ?>" width=50 height=50 frameborder=0 border=0 allowtransparency="true" ></iframe> uploaded <!--img src="http://www.remit2home.com/remittance/images/mmm_loading.gif" alt="uploading..."--> <!--iframe for percentage--> <p align="right"><input type="image" src="http://mintload.com/images/btn_upload.png" onclick="beginUpload('<?php echo $sid ?>');" alt="Upload" ></p> </body> </html> fileprog.php is alright. I need the percentage in iframe to refresh even when embedded onto upload-single.php Please help Thank you.
  6. not working/ same error. anyway. thanks a lot !
  7. I've modified code at StackOverflow link. Yet errors occur. Code: $file="path/to/file.ext"; $filesize = filesize($file); $offset = 0; $length = $filesize; if ( isset($_SERVER['HTTP_RANGE']) ) { // if the HTTP_RANGE header is set we're dealing with partial content $partialContent = true; // find the requested range // this might be too simplistic, apparently the client can request // multiple ranges, which can become pretty complex, so ignore it for now preg_match('/bytes=(\d+)-(\d+)?/', $_SERVER['HTTP_RANGE'], $matches); $offset = intval($matches[1]); $length = intval($matches[2]) - $offset; } else { $partialContent = false; } $file = fopen($file, 'r'); // seek to the requested offset, this is 0 if it's not a partial content request fseek($file, $offset); $data = fread($file, $length); fclose($file); if ( $partialContent ) { // output the right headers for partial content header('HTTP/1.1 206 Partial Content'); header('Content-Range: bytes ' . $offset . '-' . ($offset + $length) . '/' . $filesize); } // output the regular HTTP headers header('Content-Type: ' . $ctype); header('Content-Length: ' . $filesize); header('Content-Disposition: attachment; filename="' . $fileName . '"'); header('Accept-Ranges: bytes'); // don't forget to send the data too print($data); Error: ERROR The requested URL could not be retrieved While trying to process the request: GET /dl/resdl.php?f=abcc182&dlpath=f63e91d899787c647670da3fe1786484&sessid=18460a3a23d2935a856dc1ba0e2c4e11 HTTP/1.1 Host: mydomain.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Cookie: PHPSESSID=da19dd87e2b5862cdadd788dc3dd0d37 The following error was encountered: * Invalid Response The HTTP Response message received from the contacted server could not be understood or was otherwise malformed. Please contact the site operator. Your cache administrator may be able to provide you with more details about the exact nature of the problem if needed. Your cache administrator is webmaster. Generated Sat, 24 Jul 2010 09:49:37 GMT by sv18.byethost18.org (squid/2.7.STABLE9)
  8. Coz I dont know. I'm a PHP intermediate and not pro. And I've not much idea about header("___"); commands, except for Location: and Refresh: It's just my guess it would require 2-3 lines... Please help Thanks
  9. You may refer to: http://code.google.com/apis/recaptcha/docs/php.html
  10. I like the ideas. But they are incomplete chunks of code. Can someone complete the code (would require hardly 2-3 lines) Thank you
  11. Other way i can do is..copy a file to a temporary path, provide resumable download (direct link), and clear link in about 3-4 days. But thats not professional and would increase server load. Please help. Thank you
  12. Hi. You should try a new query: //either use if(isset($_GET['firstname'])), etc. here, or use this simple technique: $q=$_GET["firstName"]; $e=$_GET["lastName"]; if(!empty($q) && empty($e)) //thinking $q is not empty if user posts something $sql="SELECT * FROM user_table WHERE db_Fname = '".$q."' "; else $sql="SELECT *FROM user_table WHERE db_Lname='$e'"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { echo "<td>" . $row['db_Fname'] . "</td>"; echo "<td>" . $row['db_Lname'] . "</td>"; } Hope it helps
  13. Hi. I use this script in PHP to launch downloads. Works fine. But, I wanna make downloads resumable. Any suggestions? Please be very helpful. I really gotta do it with a simple code. <?php $fullPath="any/path/to/file.ext"; $fd = fopen ($fullPath, "r"); if ($fd) { $fsize = filesize($fullPath); $path_parts = pathinfo($fullPath); $ext = strtolower($path_parts["extension"]); switch ($ext) { case "pdf": header("Content-type: application/pdf"); // add here more headers for diff. extensions header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\""); // use 'attachment' to force a download header("Content-Length: $fsize;\n"); break; default; header("Content-type: application/octet-stream"); header("Content-Disposition: filename=\"".$path_parts["basename"]."\""); header("Content-Length: $fsize;\n"); } header("Content-length: $fsize"); header("Cache-control: private"); //use this to open files directly while(!feof($fd)) { $buffer = fread($fd, 2048); echo $buffer; } } fclose ($fd); exit; // example: place this kind of link into the document where the file download is offered: // <a href="download.php?download_file=some_file.pdf">Download here</a> ?> -I've already been to http://stackoverflow.com/questions/157318/resumable-downloads-when-using-php-to-send-the-file but found info was incomplete (if u could complete it... or so) - I donot want a complex script as offered by thomthom.net -I dont understand using header("Partial-Content:"); (i mean two variables passed offset, and remaining size) I'd really be thankful if you can help me with a simple code for supporting Resumable Downloads. Thanks!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.