Howdy, Stranger!

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

Problem with upload
  • hey,
    I've got a problem while uploading the files. It seems that the script doesn't send the url parameters.
    'script' : 'classes/upload.php?Vorschaubreite=100&Qualitaet=80&Prozess=Starten&ID=123',

    so, he can't upload anything, because I want to use folderids.
    firefbug(network status) says nothing if I hit the upload link.

    <link href=\"css/uploadify.css\" rel=\"stylesheet\" type=\"text/css\" />
    <script type=\"text/javascript\" src=\"js/jquery/jquery.js\"></script>
    <script type=\"text/javascript\" src=\"js/jquery/jquery.uploadify.v2.1.0.min.js\"></script>
    <script type=\"text/javascript\" src=\"js/swfobject.js\"></script>
    <script type=\"text/javascript\">
    $(document).ready(function() {
    $(\"#uploadify\").uploadify({
    'uploader' : 'js/uploadify.swf',
    'script' : 'classes/upload.php?Vorschaubreite=100&amp;Qualitaet=80&amp;Prozess=Starten&amp;ID=1337',
    'cancelImg' : 'images/fancy_closebox.png',
    'folder' : '../../Bildergalerie/1337',
    'queueID' : 'fileQueue',
    'auto' : false,
    'multi' : true,
    'buttonText' : 'Dateiauswahl',
    'fileDesc' : 'JPG, GIF, PNG erlaubt!',
    'fileExt' : '*.jpg;*.png;*.gif',
    });
    });
    </script>
    <form name='formular' id=\"formular\" method='post' class='niceform'>
    <fieldset>
    <legend>Bilder hochladen</legend>
    <dl>
    <dd><input type=\"file\" name=\"uploadify\" id=\"uploadify\" />
    <p><a href=\"javascript:$('#uploadify').uploadifyUpload();\">Hochladen</a> | <a href=\"javascript:$('#uploadify').uploadifyClearQueue()\">Alles Abbrechen</a></p>
    <div id=\"fileQueue\"></div>
    </dd>
    </dl>
    </fieldset>
    </form>


    also I'm using a thumbcreater of a thread.
    <?php
    /*
    Uploadify v2.1.0
    Release Date: August 24, 2009

    Copyright (c) 2009 Ronnie Garcia, Travis Nickels

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the \"Software\"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    THE SOFTWARE.
    */
    include(\"../../config.php\");
    include(\"../../mysql.php\");
    include(\"sicherheit.php\");

    $Vorschaubreite = $_GET['Vorschaubreite'];
    $Qualitaet = $_GET['Qualitaet'];
    $ID = $_GET['ID'];

    function Upload($Vorschaubreite,$Qualitaet,$ID) {

    if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
    $targetPath = str_replace('//','/',$targetPath);
    $targetFile = $targetPath . $_FILES['Filedata']['name'];
    move_uploaded_file($tempFile,$targetFile);
    }

    $imgsize = getimagesize($targetFile);
    switch(strtolower(substr($targetFile, -3))){
    case \"jpg\":
    $image = imagecreatefromjpeg($targetFile);
    break;
    case \"png\":
    $image = imagecreatefrompng($targetFile);
    break;
    case \"gif\":
    $image = imagecreatefromgif($targetFile);
    break;
    default:
    exit;
    break;
    }

    $height = $imgsize[1]/$imgsize[0]*$Vorschaubreite; //This maintains proportions
    $src_w = $imgsize[0];
    $src_h = $imgsize[1];


    $picture = imagecreatetruecolor($Vorschaubreite, $height);
    imagealphablending($picture, false);
    imagesavealpha($picture, true);
    $bool = imagecopyresampled($picture, $image, 0, 0, 0, 0, $Vorschaubreite, $height, $src_w, $src_h);

    if($bool){
    switch(strtolower(substr($targetFile, -3))){
    case \"jpg\":
    header(\"Content-Type: image/jpeg\");
    $bool2 = imagejpeg($picture,$targetPath.\"Thumbs/$Vorschaubreite_\".$_FILES['Filedata']['name'],$Qualitaet);
    break;
    case \"png\":
    header(\"Content-Type: image/png\");
    imagepng($picture,$targetPath.\"Thumbs/$Vorschaubreite_\".$_FILES['Filedata']['name']);
    break;
    case \"gif\":
    header(\"Content-Type: image/gif\");
    imagegif($picture,$targetPath.\"Thumbs/$Vorschaubreite_\".$_FILES['Filedata']['name']);
    break;
    }
    }

    imagedestroy($picture);
    imagedestroy($image);

    echo '1'; // Important so upload will work on OSX
    }


    mysql_query(\"INSERT into Bildergalerie
    (Bild,Galerie,User,Datum)
    VALUES
    ('\".sicherheit($_FILES['Filedata']['name']).\"',
    '\".sicherheit($_GET['ID']).\"',
    'Username',
    UNIX_TIMESTAMP());\");

    if (!file_exists($_GET['folder'])) {
    mkdir (\"../../Bilderalbum/\".$_GET['ID'].\"\", 0755);
    mkdir (\"../../Bilderalbum/\".$_GET['ID'].\"/Thumbs\", 0755);
    }

    Upload($Vorschaubreite,$Qualitaet,$ID);
    Upload(400,$Qualitaet,$ID);
    Upload(600,$Qualitaet,$ID);


    ?>


    thanks a lot for your awesome script and the help :-)
  • This is probably a dumb suggestion, but did you try URL encoding the query string?
  • hmm, if I open the upload.php with some url parameters the $_GET['ID'] for the mysql insert works.
    but if start it with the uploadify script the ID is empty.
  • Injected said:
    hmm, if I open the upload.php with some url parameters the $_GET['ID'] for the mysql insert works.
    but if start it with the uploadify script the ID is empty.


    Cool! That's the expected behavior, so you know that part is working.. now try adding URL Encoding to this line:

    'script'         : 'classes/upload.php?Vorschaubreite=100&amp;Qualitaet=80&amp;Prozess=Starten&amp;ID=1337',
  • by the way, a friend of mine and I tested the example from the latest download on two different servers and it didn't work. some ideas?
    //Edit: ok with 777 works. I thought 755 is enough.

    but I need some input for my problem. anyone? :)
    or is it just this url encode thing? how should it look? must I really change all ?,&,= into ascii?
  • nobody? :( *push*
  • I noticed that just the thumbnailerversion: http://uploadify.com/forum/viewtopic.php?f=5&t=33 isn't working, but the original still does.
    any solution? I just used the thumbnailerscript instead of the original uploader.php and it won't upload. didn't changed anything.