Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Sep 2009
    Posts
    57
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Argument problem

    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..

    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.
    Attached Files Attached Files
    Last edited by speedy_rudolf; 10-16-2009 at 07:27 PM.

  • #2
    Regular Coder
    Join Date
    Oct 2008
    Posts
    214
    Thanks
    5
    Thanked 22 Times in 22 Posts
    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']);
    Last edited by AlexV; 10-16-2009 at 07:30 PM.

  • #3
    New Coder
    Join Date
    Sep 2009
    Posts
    57
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by TheWolf1 View Post
    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.

  • #4
    Regular Coder
    Join Date
    Oct 2008
    Posts
    214
    Thanks
    5
    Thanked 22 Times in 22 Posts
    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).

  • #5
    New Coder
    Join Date
    Sep 2009
    Posts
    57
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by TheWolf1 View Post
    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...

  • #6
    Regular Coder
    Join Date
    Oct 2008
    Posts
    214
    Thanks
    5
    Thanked 22 Times in 22 Posts
    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).


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •