/    Sign up×
Community /Pin to ProfileBookmark

Upload Files To Folder (Max Size)

I am looking for a simple php code that does the following. Uploads a file, up to 50MB, and stores it in a folder. I can find code to do this, but what I really need is a animated image to be played during the upload… and once its done, the image goes away and it says “Upload complete”… thanks so much ahead of time.

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJul 15.2006 — Some output buffering along with a bit of JavaScript can do something like that:
[code=php]
<?php
ob_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang='en'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>
<title>Upload File</title>
<script type="text/javascript">
function hidediv(id) {
//safe function to hide an element with a specified id
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(id).style.display = 'none';
}
else {
if (document.layers) { // Netscape 4
document.id.display = 'none';
}
else { // IE 4
document.all.id.style.display = 'none';
}
}
}
</script>
</head>
<body>
<div id='working'>
<img src="http://www.charles-reace.com/image/cornet.jpg" alt="cornet">
</div>
<?php
ob_flush();
flush(); // image should now be displayed

// simulate time to process upload
sleep(5); // your actual upload processing code would go here
?>
<script type="text/javascript">
hidediv("working");
</script>

<p>All done!</p>
</body>
</html>
[/code]
Copy linkTweet thisAlerts:
@NogDogJul 15.2006 — It occurred to me after I wrote the above that this probably isn't what you're looking for, as it would only display the "processing" image [i]after[/i] the file was received. (The time to process the file on the server once it's received will likely be significantly less than the upload time. Perhaps this is something that can be done via JavaScript on the form page that sends the file?
Copy linkTweet thisAlerts:
@msbeckmanauthorJul 18.2006 — Yea, I am looking for something that displays the image while its uploading, to let the user know that there stuff is being uploaded to my server. Nothing fancy, just a animated gif. I only really know my way around CSS, XHTML, and XML... so ya. I will try posting this in the JavaScript forum because according to you it should be done via JavaScript? Thanks for your help though!
Copy linkTweet thisAlerts:
@felgallJul 18.2006 — For files bigger than about 2Mb it is far more efficient to use FTP processing than anything else for the transfer since most other methods limit you to about 2Mb max size and are extremely inefficident above that size anyway.
Copy linkTweet thisAlerts:
@msbeckmanauthorJul 18.2006 — @ Felgall

how would you go about implementing that into a script?


http://www.fhnfilms.com/index2.php
×

Success!

Help @msbeckman spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...