This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Problem with file upload.


  1. MvdL79
    Member

    I am getting errors when a customer tries to upload a file.

    Warning: move_uploaded_file(./data/form_14/files/element_33-7-simpel_voorbeeld.jpg.tmp): failed to open stream: No such file or directory in /var/www/vhosts/notpublic.nl/httpsdocs/bestelformulieren/includes/post-functions.php on line 1077

    Warning: move_uploaded_file(): Unable to move '/tmp/phpurDEMM' to './data/form_14/files/element_33-7-simpel_voorbeeld.jpg.tmp' in /var/www/vhosts/notpublic.nl/httpsdocs/bestelformulieren/includes/post-functions.php on line 1077

    Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/notpublic.nl/httpsdocs/bestelformulieren/includes/post-functions.php:1077) in /var/www/vhosts/notpublic.nl/httpsdocs/bestelformulieren/view.php on line 51

    Posted 16 years ago #
  2. MvdL79
    Member

    Line 1077 in post-functions.php:

    //for form with review enabled, append .tmp suffix to all uploaded files
    //move file and check for invalid file
    $destination_file = $input['machform_data_path'].DATA_DIR."/form_{$form_id}/files/{$element_name}-{$record_insert_id}-{$_FILES[$element_name]['name']}.tmp";
    if (move_uploaded_file($_FILES[$element_name]['tmp_name'], $destination_file)) {
    $filename = mysql_real_escape_string($_FILES[$element_name]['name']);
    $query = "update ap_form_{$form_id}_review set $element_name='{$element_name}-{$record_insert_id}-{$filename}' where id='$record_insert_id'";
    do_query($query);
    }
    Posted 16 years ago #
  3. yuniar

    This is the causing problem:

    Warning: move_uploaded_file(): Unable to move '/tmp/phpurDEMM' to './data/form_14/files/element_33-7-simpel_voorbeeld.jpg.tmp' in /var/www/vhosts/notpublic.nl/httpsdocs/bestelformulieren/includes/post-functions.php on line 1077

    Your file doesn't seem to be uploaded to the /tmp folder.
    Try to upload smaller file size < 1Mb.

    Let me know how it goes.


    MachForm Founder

    Posted 16 years ago #
  4. MvdL79
    Member

    It was already a small file, cause I tried it myself.
    And I also changed the limit on file sizes through the server and PHP config file.

    So it shouldn't be a problem.

    I also remembered having the same problem before.

    I already have angry customers because of this...

    :(

    Posted 16 years ago #
  5. yuniar

    Hmm.. is your /tmp folder writable? it should have writable permission (CHMOD 777).

    If it's already writable and the problem persist, I'll need to investigate this directly.
    Can I login to your FTP to check this?

    Mail your FTP details to: customer.service [at] appnitro.com
    or submit here: http://www.appnitro.com/support/index.php?pg=request


    MachForm Founder

    Posted 16 years ago #
  6. MvdL79
    Member

    Uhmz... The "Data", "form_xx" and "CSS" folders are all 777.
    But I cannot seem to find the tmp folder at all?

    Where is it supposed to be located?

    Really weird.

    Also, like I said, I had this problem before. When I created the upload form.

    Where should the "tmp" be located? I will try creating several tmp folders myself and see if works then.

    Posted 16 years ago #
  7. MvdL79
    Member

    Okay... I think I may have found a bug.

    I created a directory called "files" in the appropiate forms directory.
    And apparatently it works once again.

    And I also know what is causing this and why I had this problem before.

    As soon as you delete a uploaded file through Machform's control panel. It also deletes the directory. And that's what causing the problems...

    Any way to solve this permantly? So it only removes the file and not the directory?

    Posted 16 years ago #
  8. yuniar

    Hmm.. is your PHP running under Safe Mode?

    If not, this seems to be permission problem.
    Your web server, doesn't seem to have proper privileges to your "data" folder.

    When you delete selected files, MachForm doesn't remove the directory.
    However, if you click "Delete All Entries" .. MachForm indeed delete the "files" directory and then re-create the directory again.

    If your webserver is having permission problem, it might be unable to re-create the "files" directory.

    In your case, I suggest not to use the "Delete All Entries".


    MachForm Founder

    Posted 16 years ago #
  9. MvdL79
    Member

    Yes the server is running PHP safe mode, but I can disable it for a directory.
    For which directory should I disable it? If that is causing the problem?

    I don't have other problems with Machform at all though...

    Posted 16 years ago #
  10. yuniar

    Ahh.. I see.
    I suppose the PHP Safe Mode is the problem.

    Try to disable it for your "machform/data" folder.
    If that doesn't work either, try to disable it for your "machform" folder.

    I didn't know that Safe Mode can be disabled per directory though.
    Can you let me know how to do it?


    MachForm Founder

    Posted 16 years ago #
  11. MvdL79
    Member

    It's a Plesk server with 4PSA Total Domains. With Total Domains you can set varies strings within PHP.

    Anyways I turned off safe_mode for several directories (checked it through PHP info) and removed the files directory, but I still get the errors. It's unable to create the files directory.

    Anyways, I now re-created the directory. put an empty .txt file in it with and changemodded it to 0. Hopefully the directory will stay there this time.

    Though this is not a perfect solution, it should work...

    Posted 16 years ago #

RSS feed for this topic

Reply