Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 新手在使用ASIHTTPRequest上传文件时遇到问题_Php_Iphone_Cocoa Touch_Ios_File Upload - Fatal编程技术网

Php 新手在使用ASIHTTPRequest上传文件时遇到问题

Php 新手在使用ASIHTTPRequest上传文件时遇到问题,php,iphone,cocoa-touch,ios,file-upload,Php,Iphone,Cocoa Touch,Ios,File Upload,我真的,真的,真的需要一些帮助。我到处都看了一些关于使用ASIFormDataRequest上传照片的详细文档(针对傻瓜)。有人能通过我给我一条生命线吗 这是我所拥有的,虽然我知道我可能离这很远 照相机 #import <UIKit/UIKit.h> @class ASIFormDataRequest; ... 这是我收到的剧本 $dir_dest = 'uploads/'; ob_start(); print_r($_FILES); $test = ob_get_conten

我真的,真的,真的需要一些帮助。我到处都看了一些关于使用ASIFormDataRequest上传照片的详细文档(针对傻瓜)。有人能通过我给我一条生命线吗

这是我所拥有的,虽然我知道我可能离这很远

照相机

#import <UIKit/UIKit.h>
@class ASIFormDataRequest; 

...
这是我收到的剧本

$dir_dest = 'uploads/';
ob_start();
print_r($_FILES);
$test = ob_get_contents();
ob_end_clean();
$db->insert('connecttest', array('ts'=>date('Y-m-d H:i:s'), 'tempfield'=>$test))->execute();
这是我得到的结果

Array
(
    [(null)] => Array
        (
            [name] => (null)
            [type] => (null)
            [tmp_name] => C:\Windows\Temp\phpCFF0.tmp
            [error] => 0
            [size] => 0
        )

)

请帮助:(

我遇到了类似的问题,我使用

UIImage *im = [info objectForKey:@"UIImagePickerControllerOriginalImage"] ;
UIGraphicsBeginImageContext(CGSizeMake(320,480)); 
[im drawInRect:CGRectMake(0, 0,320,480)];
newImage = UIGraphicsGetImageFromCurrentImageContext(); 
UIGraphicsEndImageContext();
NSData* imageData=UIImageJPEGRepresentation(newImage, 0.5); 
当它开始工作时,拍摄的图像的高度和宽度将超过2000x2000,所以缩小它并尝试一下

[request setData:imageData withFileName:@"photo.jpg" andContentType:@"image/jpeg" forKey:@"file"];
这是php脚本

$filename="uploaded";
$target_path = "uploads/";
$target_path = $target_path .$filename.".jpg"; 
if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
echo "uploaded an image";
} else{
    echo "There was an error uploading the file, please try again!";
}
$filename="uploaded";
$target_path = "uploads/";
$target_path = $target_path .$filename.".jpg"; 
if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
echo "uploaded an image";
} else{
    echo "There was an error uploading the file, please try again!";
}