简体   繁体   English

来自PHP的Java脚本翻译响应(自定义错误代码)

[英]Response from PHP for Javascript to translate (custom error codes)

Regarding Uploadify 关于Uploadify

Hello, Currently I have a PHP only upload script and I'm planning to replace it with Uploadify. 您好,目前,我有一个仅PHP的上传脚本,我打算将其替换为Uploadify。 My PHP script uploads, checks the file, displays any errors or the download link. 我的PHP脚本上传,检查文件,显示任何错误或下载链接。

I should be able to do all this by using onAllComplete and onError. 我应该能够通过使用onAllComplete和onError来完成所有这些工作。 But unless I'm missing something I can't see what PHP must output to generate an error for the Javascript to recognize and act upon. 但是除非我丢失了某些东西,否则我看不到PHP必须输出什么才能产生错误以使Javascript能够识别并采取行动。

Ideally I'd have the PHP output an error code and then have the Javascript display the error message somewhere. 理想情况下,我会让PHP输出错误代码,然后让Javascript在某处显示错误消息。 Then if the upload were a success I'd have the PHP output an ID of the file which can be used to display a download link. 然后,如果上传成功,我将让PHP输出文件的ID,该ID可用于显示下载链接。

Thanks a lot 非常感谢

If I remember correctly. 如果我没记错的话。 And it might have changed. 而且它可能已经改变。 Uploadify only gets back a 1 or 0 from PHP. Uploadify仅从PHP返回1或0。 So the error might just be that one occurred, not which one. 因此,错误可能只是发生了一个,而不是哪个。

That said. 那就是。 The Uploadify PHP is like 10 lines long. Uploadify PHP大约有10行。 Just mod it to report error codes if the newer Uploadify does not already. 如果还没有更新的Uploadify,只需对其进行修改以报告错误代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM