Jump to content

fahim_junoon

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

fahim_junoon's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks! It works great, it was only a second or two out during a 50 second upload when I tested it.
  2. Yea that may work, only problem is I don’t know much JavaScript either. I’ll have a look and see if there is a function like php’s time() but in JavaScript so it will work properly. Thanks.
  3. Sorry thanks for that. The hidden input method still didn’t work as expected though as the user could wait a minute before clicking upload and then the time taken to upload will say 1 minute 30 seconds even if it took 30 seconds. Here's the code i used. <?php if (isset($_FILES['avatar']['tmp_name'])) { $start_time = $_POST['time']; echo "Start time: $start_time<br />"; $uploadfile = $_FILES['avatar']['tmp_name']; $path = "testing/test1"; if (move_uploaded_file($uploadfile, $path)) { echo 'File uploaded!<br />'; $endtime = time(); echo "End time: $endtime"; } $timetaken = $endtime - $start_time; echo "Time Taken: $timetaken"; } ?>
  4. This is quite strange but when you put a hidden input field into the form either the browse button disappears if it is put before the file input or the upload button disappears if it is put after the file input. This happens in both ie7 and firefox. <form action="" method="post" enctype="multipart/form-data"> <input type="file" name="avatar" /> <input type="hidden" name="time" value="<?php echo time(); ?> /> <input type="submit" value="Upload" /> </form>
  5. Thanks cronix i'll give it a try
  6. Yea I think you’re right otherwise the code execution time should be longer than 0.0056 or whatever it was.
  7. Hi Not sure if this will solve your problem but have you tried ORDER BY RAND() on the sql query?
  8. Nope still get the same time 0.00160503387451 I might just drop this for now as it’s not really a necessity for the system to work. it’s just that I was planning on creating a video upload form and it would be cool to know how long it took to upload a video and have that time stored in the database as an extra bit of info. Thanks for the help
  9. Hi Try this <?php $var = "[email protected]"; $split = explode("@", $var); echo $split[0]; ?>
  10. Hi Thanks for the link but it still isn't working how i want. Here is my code. <?php if (isset($_FILES['avatar']['tmp_name'])) { $time_start = microtime(true); $uploadfile = $_FILES['avatar']['tmp_name']; $path = "testing/test1"; if (move_uploaded_file($uploadfile, $path)) { echo 'File uploaded!<br />'; } $time_end = microtime(true); $time = $time_end - $time_start; echo 'Script took '.$time.' seconds to exicute'; } ?> <form action="" method="post" enctype="multipart/form-data"> <input type="file" name="avatar" /> <input type="submit" value="Upload" /> </form> The problem is that it records how long the script took to execute which was 0.00161695480347 seconds. I want it to tell me how long it took to transfer the file from the user's computer to the server e.g. 35 seconds. I think php first uploads the file to the server before processing the if (isset($_FILES['avatar']['tmp_name'])) and so i cannot find out how long it took, only how long it took for the rest of the code including moving the temporary file to the new location.
  11. Hi all I’ve created a form with which a user can upload files, for example images, to the server. I would like to record how long it took php to upload the file to the server so that i can display this to the user. I have tried using a timestamp before moving the file and then a timestamp afterwards but the timestamps are exactly the same. Is there anyway to record how long it took php to write the file to the tempory directory? 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.