Forum Moderators: coopster

Message Too Old, No Replies

Upload Progress Meter

Upload Progress Meter

         

drooh

9:13 pm on May 10, 2007 (gmt 0)

10+ Year Member



I am working with an upload progress meter that i got from hotscipts. It uses a flash module & php to function.

The problem I am having is that is seems to work only 1/2 the time. Which is wierd, because you would think it would either work or not work.

I am trying to examine my code to see if I am properly setting the directory.


<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.

echo 'Upload result:<br>'; // At least one symbol should be sent to response!

$uploaddir = 'C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\xfer\\';
$uploadfile = $uploaddir . basename($_FILES['Filedata']['name']);

echo '<pre>';
if (move_uploaded_file($_FILES['Filedata']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}

echo 'Here is some more debugging info:';
print_r($_FILES);

echo "</pre>";

?>

on the line where I have
$uploaddir = 'C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\xfer\\';

I am wondering if this is correct. There are many options that I am thinking could be the best, such as

$uploaddir = 'C:\\Program Files\Apache Software Foundation\Apache2.2\htdocs\xfer\\';

$uploaddir = 'C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/xfer//';

$uploaddir = 'C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\xfer\';

$uploaddir = '../';

$uploaddir = '..//';

any ideas? thank you :)

mcibor

9:24 pm on May 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you checked

upload_max_filesize and post_max_size?
<IfModule mod_php4.c>
php_value upload_max_filesize 50M
php_value post_max_size 50M
</IfModule>

- means 50MB upload limit.

Also, make sure that the setting for the post_max_size allows for a proper file size range.

post_max_size = 128M ; Expands the size of POST data for file uploads

Found on www.php.net

Michal

drooh

4:19 am on May 11, 2007 (gmt 0)

10+ Year Member



is that in the php.ini or in the apache config?

HoboTraveler

7:55 am on May 11, 2007 (gmt 0)

10+ Year Member



That would be the php.ini.

BTW, you can override the php.ini by increasing the upload limit in the .htaccess

drooh

9:29 pm on May 11, 2007 (gmt 0)

10+ Year Member



ok ill give that a try, and BTW... would you happen to have a solution for showing an upload progress meter?

im also thinking it could be a problem with the flash module.

mcibor

8:21 am on May 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I know only, that it's possible with Apache 2. Have you checked [hotscripts.com?...]

henry0

11:29 am on May 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



May 6th Coopster and Eelix gave you some LINKS [webmasterworld.com]

This one could be ADDED [pear.php.net] to the list

drooh

8:02 pm on May 14, 2007 (gmt 0)

10+ Year Member



henry0,

I have looked over the site on pear.php.net.

I have spent about an hour now and cannot make sense of anything. Could you please point me in the right direction.

for instance on their code it is calling for other .php files that dont exist and the instructions are in poor english.

take a look (using version 2.3)
starting at line 23 of Progress2.php
require_once 'HTML/Common.php';
require_once 'HTML/CSS.php';
require_once 'Event/Dispatcher.php';

yet when i unziped the package there were no folders for event or html. furthermore the files inside those folders dont exist anywhere else.

have you used this package? if so can you lend a helping hand?

henry0

9:18 pm on May 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I wish I did
not a long time ago I too was complaining about how hermetic PEAR is.
Hope someone could help.
But I remember that I bookmarked it because it has been mentionned here.