...

View Full Version : Argument problem



speedy_rudolf
10-16-2009, 07:06 PM
Hi. I'm trying to get php to fetch some files, but I can't figure out how to do it...here is the code..


<?php
require("class.easyzip.php");

$zip = new EasyZip;
$zip -> addFile("$_POST['Fis_lay']");
$zip -> addFile("$_POST['Fis_lay']");
$zip -> splitFile("site.zip", 5000000);
echo 'Attachment has been sent Successfully.';
?>

I have tried with no quotation marks, no apostrophe, quotation marks instead of apostrophe, but it always sais "Error: file does not exist" of another (very long) error on line 5. Any help is very much appreciated. Bye.

AlexV
10-16-2009, 07:23 PM
What is $_POST['Fis_lay']? It must be a valid SERVER path. Also not sure if spaces between var, -> and method is valid (I think it is, but too lazy to check it up)...

Also dont use quotes there (its "weird" to use them only with a var in it)

$zip -> addFile("$_POST['Fis_lay']");
becomes
$zip->addFile($_POST['Fis_lay']);

speedy_rudolf
10-16-2009, 07:26 PM
What is $_POST['Fis_lay']? It must be a valid SERVER path. Also not sure if spaces between var, -> and method is valid (I think it is, but too lazy to check it up)...

Also dont use quotes there

$zip -> addFile("$_POST['Fis_lay']");
becomes
$zip->addFile($_POST['Fis_lay']);

OK...I just figured out I should be requesting the file....so...how do I request a file? The main idea is to have the php get the files directly from the client, before they are uploaded. As you can see from the code, its purpose is to create a plitted archive on the fly. The reason for me doing this is because the server I am on doesn't accept files bigger then 5mb, and the form has a few (about 6) file inputs and to not make the user create the split archive himself, I gather the files (actually clientside filenames and locations) and create the archive directly on the server. Anyway... I repeat the question...how do I request a file? Thanks.

AlexV
10-16-2009, 07:34 PM
The main idea is to have the php get the files directly from the client, before they are uploaded.

You can't BEFORE the upload unfortunatly. If you want to do it before the upload, use an ActiveX (IE) or some universal "plugin" (maybe Flash or Java can do this).

For "regular" file upload, try the following tutorial:
http://www.tizag.com/phpT/fileupload.php
After the upload you can zip em with PHP and dispose of the unzipped ones and do whathever you want with the ZIP (mail, etc).

speedy_rudolf
10-16-2009, 07:43 PM
You can't BEFORE the upload unfortunatly. If you want to do it before the upload, use an ActiveX (IE) or some universal "plugin" (maybe Flash or Java can do this).

For "regular" file upload, try the following tutorial:
http://www.tizag.com/phpT/fileupload.php
After the upload you can zip em with PHP and dispose of the unzipped ones and do whathever you want with the ZIP (mail, etc).

Ss I said, the server doesn't allow files bigger than 5mb, and, most users, for at least one of the inputs, will select files bigger (much, much bigger) than 5 mb...and most of them will be idiots, so they won't know how to split an archive, and I can't teach them how to do it...so...you see my problem? But...I'll try to find something else...Thanks anyway...

AlexV
10-16-2009, 08:05 PM
Yeah I understand your problem but PHP is a SERVER SIDE language... PHP can't access files that are on your HDD.

The only way I see to solve your problem is to use a CLIENT SIDE solution (something like Adobe Flash, Java or some other third party plugin).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum