将 Flash 中的图像以不同的名称保存在服务器上
我遵循了这个问题: flash Actionscript 3 和 PHP 图像上传 我复制了代码:
function uploadFile( e:Event ):void
{
fileRef.upload( new URLRequest( "http://localhost/php5dev/test/upload_script.php" ), "as3File", false );
}
它
<?php
$target = "uploads/" . basename( $_FILES[ "as3File" ][ "name" ] );
if ( move_uploaded_file( $_FILES[ "as3File" ][ "tmp_name" ], $target ) )
echo( "file upload success<bt />" );
else
echo( "error uploading file<br />" );
?>
效果很好,我只需要知道如何以特定名称保存图像,如何将参数传递给 php 脚本?或者这是不必要的,我可以在调用脚本之前更改它吗?
然后我如何调用 URLrequest 向用户显示他上传的文件? 谢谢,任何答案!
I followed this question:
flash Actionscript 3 and php image upload
I copied the code:
function uploadFile( e:Event ):void
{
fileRef.upload( new URLRequest( "http://localhost/php5dev/test/upload_script.php" ), "as3File", false );
}
and
<?php
$target = "uploads/" . basename( $_FILES[ "as3File" ][ "name" ] );
if ( move_uploaded_file( $_FILES[ "as3File" ][ "tmp_name" ], $target ) )
echo( "file upload success<bt />" );
else
echo( "error uploading file<br />" );
?>
It works great, I just need to know how to save the image under a specific name, how do I pass an argument to the php script? or is that not necessary, can I change it before calling the script?
How would I then call URLrequest to show user the file he uploaded ?
Thanks, for any answers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过 GET 查询发送文件名:
然后在 PHP 中将其检索为 $_GET['filename'];
一句建议是,请小心使用这些脚本,因为它们非常不安全(人们可以将任何文件上传到您的服务器并很容易地利用它)。
You could send the filename via a GET query:
And then retrieve it in PHP as $_GET['filename'];
As a word of advice, be careful with those scripts since they are very insecure (one could upload any file to your server and exploit it very easily).