我上传了iPhone应用程序中的图像数据。如何在php中更改上传directroy?
我解码图像数据,并试图将图像保存在文件中。
我总是收到错误消息
文件 HREF = 'function.file-把-内容'> function.file-把-内容]: 未能打开流:权限被拒绝在
define('UPLOAD_DIR', '/Applications/XAMPP/xamppfiles/htdocs/mc311');
$data = base64_decode($Image);
$file = UPLOAD_DIR . uniqid() . '.png';
$success = file_put_contents($file, $data);
print $success ? $file : 'Unable to save the file.';
$path = $file;
你缺少一个:
最后,如果这没有工作,如果你是在OSX环境下,试试这个在终端'/ UPLOAD_DIR'末尾的'/' – Brewal
@Brewal,会导致权限被拒绝错误吗? O.o我不这么认为。 –
是的,详情请参阅我的回答。 – Brewal