FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Best Upload





sergio_ykz
Who know a script to upload a file with progress, or to load dinamically load page content like hotmail live?
X3 Talk
The best example of a script I can show you is this:
W3 SCHOOLS CODE
The Upload Form:
Quote:

Code:

<html>
<body><form action="upload_file.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form></body>
</html>


The script:
Quote:

Code:
<?php
if (($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
&& ($_FILES["file"]["size"] < 20000))
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "<br />";
    echo "Type: " . $_FILES["file"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";    if (file_exists("upload/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "upload/" . $_FILES["file"]["name"]);
      echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
      }
    }
  }
else
  {
  echo "Invalid file";
  }
?>


This script puts restrictions on the upload which you can edit later. These restrictions currently mean that you can only upload a .jpg or a .gif file (you have to know your mime types) and it must be less than 20 000 bytes in size.

There is no progress bar.
Boffel
This looks great, but where to put the script? Sorry, im a beginner with php.
sonam
Quote:
This looks great, but where to put the script? Sorry, im a beginner with php.


If you are looking in form code you will see action="upload_file.php" whats mean form is one file (htm, html, php)and upload_file.php is another file.

Sonam
rachrach
hi how can i Upload just a html page
<?php
$str="nombreparagraphes".$i;
$_SESSION[$str]=intval($_REQUEST[$str]);
$nbr=intval($_REQUEST[$str]);
for($j=1; $j<=$nbr; $j++)
{
?>


paragraphe <?=$j?>: <input type="file" name="paragraphe<?=$i?><?=$j?>" ><br>



<?php
}
?>
codersfriend
If you're looking for an uploader script with progress bar, you should try an ajax uploader
like valums uploader https://github.com/valums/file-uploader ..
another uploader I know is uploadify which uses flash
http://www.uploadify.com/
jmraker
Another option is to use swfupload. It uses the flash plugin but normal HTML/javascript for everything except for one button that you press to select one or more file(s).
http://code.google.com/p/swfupload/

This is an old demo of a drag and drop upload to show what firefox 3.6+ can do to improve file uploads
https://developer.mozilla.org/media/uploads/demos/p/a/paulrouget/8bfba7f0b6c62d877a2b82dd5e10931e/hacksmozillaorg-achi_1334270447_demo_package/uploadingFiles/index.xhtml
https://github.com/paulrouget/hacks.mozilla.archives/tree/master/imageUploader
Related topics
Best FTP Client on EARTH
Problem with Image upload mod from phpBBstyles
Can I copy/upload entire directories in a frihost account
Try it! The Best Online Web FTP
How do you upload in Ascii mode and binary mode and whats th
FTP upload problem
What is the best way to upload (many small) files?
What is the best ftp client / uploader program?
[OFFICIAL] Favourite/Best CMS
Adsense guide... Its really working
How to build simple PHP upload form
upload File using ajax php or IFrame
Which server to upload and download is the best?
what is the best forum tools ?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.