Показать сообщение отдельно

  #6  
Старый 13.07.2009, 17:42
alwex
Участник форума
Регистрация: 14.12.2008
Сообщений: 140
Провел на форуме:
186812

Репутация: 14
По умолчанию

смотрите, я скачал граффити вконтакте и хотел переделать но у меня не передает данные. я открыл исходник:

Код:
 private function onSend(param1)
        {
            var ba:ByteArray;
            var e:* = param1;
            showMessage(this.lang.msgSaving);
            var bd:* = drawingArea.bitmapData();
            ba = PNGEncoder.encode(bd);
            ba.position = 0;
            var imageBytes:* = ba;
            var boundary:String;
            var header1:* = "--" + boundary + "\r\n" + "Content-Disposition: form-data; name=\"Signature\"\r\n\r\n" + "";
            var header2:* = "\r\n--" + boundary + "\r\n" + "Content-Disposition: form-data; name=\"Filedata\"; filename=\"graffiti.png\"\r\n" + "Content-Type: image/png\r\n\r\n" + "";
            var header3:* = "--" + boundary + "\r\n" + "Content-Disposition: form-data; name=\"Upload\"\r\n\r\n" + "Submit Query\r\n" + "--" + boundary + "--";
            var headerBytes1:* = new ByteArray();
            headerBytes1.writeMultiByte(header1, "ascii");
            var headerBytes2:* = new ByteArray();
            headerBytes2.writeMultiByte(header2, "ascii");
            var headerBytes3:* = new ByteArray();
            headerBytes3.writeMultiByte(header3, "ascii");
            var imageCopyForSignature:* = new ByteArray();
            imageCopyForSignature.writeBytes(imageBytes, 0, imageBytes.length);
            var signatureBytes:* = new ByteArray();
            var dataString:* = Base64.encodeByteArray(imageCopyForSignature).substr(0, 1024);
            var signatureString:* = MD52.encrypt(dataString);
            signatureBytes.writeMultiByte(signatureString, "ascii");
            var sendBytes:* = new ByteArray();
            sendBytes.writeBytes(headerBytes1, 0, headerBytes1.length);
            sendBytes.writeBytes(signatureBytes, 0, signatureBytes.length);
            sendBytes.writeBytes(headerBytes2, 0, headerBytes2.length);
            sendBytes.writeBytes(imageBytes, 0, imageBytes.length);
            sendBytes.writeBytes(headerBytes3, 0, headerBytes3.length);
            var request:* = new URLRequest(postTo);
            request.data = sendBytes;
            request.method = URLRequestMethod.POST;
            request.contentType = "multipart/form-data; boundary=" + boundary;
            var loader:* = new URLLoader();
            loader.addEventListener(Event.COMPLETE, uploadCompleted);
            loader.addEventListener(IOErrorEvent.IO_ERROR, uploadError);
            try
            {
                showMessage(this.lang.msgLoading);
                loader.load(request);
            }
            catch (error:Error)
            {
                this.uploadError(null);
            }
            return;
        }// end function
но когда я в PHP файле делаю $file = $_FILES['Filedata']['name'] например, то ничего не выходит

print_r($_FILES);
тоже самое... кто знает в чем ошибка
 
Ответить с цитированием