Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Another one on IO error #2038
  • Hi,

    First of all, great job guys!, my compliments.

    So, I downloaded uploadify, installed, all working, I go to my mac, try to upload a file and I get the IO error #2038.

    I looked all other posts in the forum, it was not caused by the mod_security, it was not related to the server at all and it was only happening in the mac. After testing a lot I found that the problem was passing values to the scriptData with spaces in it:

    scriptData{
    var1: 'this causes the error'
    }

    What I did to fix it is base64 encode the value:

    scriptData {
    var1: $.base64Encode('this wont cause the error');
    }

    Please note that the base64encode function in that code is a JQuery plugin function, there are other non-jquery implementations of that function out there as base64 encoding is not part of the core javascript.

    I tried with escape and encodeURI before going to base64encode but it seems that uploadify decodes the string at some point and the spaces got back in place thus causing the error.

    I am not sure if this can be considered a bug or not, as it only happens on Mac, just posting here in case anyones faces it again.

    Cheers.
  • I was facing the same problem and you just saved my day :)
    I moved from a Win PC to Mac and simply couldn't understand why everything works fine on the PC but on the MAC i got the same 2038 error when tried to pass parameters to my script.

    In my case the problem was not with white spaces but rather with non-alphanumeric characters I passed (#!_+ etc).

    Thanks for the lead :)

    /Vx
  • Hi!

    I also have this problem on Mac. My Javascript knoledge is poor, so maybe you can me help out with this one?

    This is de code I am using. The $dest variable is the destination and the error occures when there are spaces in the input $dest.

    This is the code I'm using:

    $(document).ready(function() {
    $(\"#fileUpload2\").fileUpload({
    'uploader': 'uploadify/uploader.swf',
    'cancelImg': 'uploadify/cancel.png',
    'script': 'uploadify/upload.php',
    'folder': '<?php echo $dest?>',
    'multi': true,
    'fileDesc': 'Afbeeldingen',
    'fileExt': '*.jpg;*.jpeg;*.gif;*.png',
    'checkScript': 'uploadify/check.php',
    'displayData': 'speed',
    'sizeLimit': 5242880,
    'simUploadLimit': 10,
    onAllComplete: function () {
    window.location=\"upload_resize.php?map=<?php echo $map;?>\";
    }

    });


    });



    Thanks!
    Nithrill
  • When setting out directory structures for the web you really should avoid placing spaces in the name of folders and names. By doing so you introduce the possibility of services not being able to correctly resolve. The normal way to mark a space is to use the underscore character '_'.

    If you are insistent on using a space in the folder name, then you could try:

    Note that this is completely untested
    set folder to ''
    use scriptData to set the folder ie scriptData: {'folder' : '<?php echo base64_encode($dest) ?>'};
    remember to base64_decode the folder GET var in the upload.php before using it.
    This will send two 'folder' params to the upload script but theoretically the second one should overwrite the first when retrieved. If it doesn't send it as 'folder2' and retrieve the 'folder2' GET var instead.
  • Hi!

    Tnx for the quick answer. Unfortunately it didn't worked out. The script I used:

    $(document).ready(function() {
    $(\"#fileUpload2\").fileUpload({
    'uploader': 'uploadify/uploader.swf',
    'cancelImg': 'uploadify/cancel.png',
    'script': 'uploadify/upload.php',
    'folder': '',
    'multi': true,
    'fileDesc': 'Afbeeldingen',
    'fileExt': '*.jpg;*.jpeg;*.gif;*.png',
    'checkScript': 'uploadify/check.php',
    'scriptData': {'folder2': '<?php echo base64_encode($dest) ?>'},
    'displayData': 'speed',
    'simUploadLimit': 10,
    onAllComplete: function () {
    window.location=\"upload_resize.php?map=<?php echo $map;?>\";
    }

    });


    });


    upload.php

    if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $undecoded_folder = $_GET['folder2'];
    $decoded_folder = base64_decode($undecoded_folder);
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $decoded_folder . '/';
    $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];


    move_uploaded_file($tempFile,$targetFile);
    }

    echo '1';


    I guess spaces are just something that needs to be avoided.
  • I had this exact problem and solved it by not passing data via the query string. When uploading to a script "mydomain.com/upload.php" was fine, but if I used "mydomain.php?id=1" then I got the dreded IO 2038 error. My url was not malformed or anything not-normal, it just seemed as if the mac version of flash just can't handle the questions mark or anything afterwards!
  • Thank you so much, tfoston! I've been fighting with this for way too long and that was exactly the issue...damn Apple! ;)