The basic HTML for an upload form looks like:
The way you handle the submission depends on which args method you chose for the ApacheHandler class.
Under the 'CGI' method (default for 1.0x), you can use the $m->cgi_object method to retrieve a CGI.pm object which can be used to retrieve the uploaded file. Here is an example using the 'CGI' method:
Please see the CGI.pm documentation for more details.
Under the 'mod_perl' method (default for 1.1x), the request object available as $r in your components will be an object in the Apache::Request class (as opposed to the Apache class). This object is capable of returning Apache::Upload objects for parameters which were file uploads. Please see the Apache::Request documentation for more details. Here is an example using the 'mod_perl' method:
For more information on how to manually set the args method, see the ApacheHandler documentation.
If you are using CGI.pm, there are some configuration issues to be aware of. CGI.pm needs a tmp directory, and you probably want to be able to specify what that directory is.
Try doing this in your httpd.conf or handler.pl:
You must do this before you load either the HTML::Mason or HTML::Mason::ApacheHandler modules.
That may change which directories CGI tries to use.
You could also try
during startup, either in your httpd.conf or handler.pl
The root of the problem is probably that the temp directory is being chosen when the module loads uring server startup while its still root. It sees it can write to /usr/tmp and is happy. Then when actually running as nobody it dies.
I bet Lincoln would welcome a patch (hint, hint). One solution would be to check if you're running under mod_perl and you're root. If so, then check Apache->server->uid and see if that id can write to the temp directory too.
两种方法中,当然使用mod_perl为佳,cgi的实现方式还需要写缓存文件,如果磁盘空间不足,则会出现无法上传的情况。
一个使用的实例:http://passport.maxthon.cn/new/myprofile/avatar.html
引自:http://www.masonhq.com/?FAQ:HTTPAndHTML#h-how_can_i_handle_file_uploads_under_mason
分享到:
相关推荐
本书向读者展示了如何创建大型,复杂,动态驱动的网站,这些网站看起来不错并且可以使用Perl和Mason轻松维护。
vim-mason Mason 的 Vim 语法文件(Perl 嵌入 HTML)基于来自的 Andrew Smith 版本安装如果您没有首选的安装方法,可以使用安装此脚本。 如果您安装了 vundle,只需将以下内容粘贴到您的 .vimrc 文件中: 捆绑'aming...
使用Mason等效电路设计SAW滤波器
Mason.m 使用梅森法则来简化信号流图。 它需要一个描述网络的文件,并生成一个符号方程,将相关输出节点与独立输入节点相关联。 该目录包含一个全面的自述文件和一个用于试验的示例网络文件。 梅森法则传统上用于...
python库。 资源全名:mason_framework-0.0.6-py3-none-any.whl
安装对于命令行用法,请全局安装Mason: npm i -g @mason-cli/bin配置您可以通过在项目目录中创建mason.config.js文件来向Mason加载其他插件。配置示例: mason.config.js module . exports = function ( Mason ) {...
梅森克利 当前的版本: masonclj是一个非常小的库,提供了... 这为masonclj假定的一些设计选择提供了理论依据,但对于那些希望在不使用MASON的情况下用Clojure编写ABM的人也可能会感兴趣。 一些Clojure-Java互操作性
analysys_mason_sigfox_lpwa_finding_niche_june2019_rdme02
Table of Contents 1. Introduction to Aircraft Design 2. Essential Physics and Technology of Aircraft Flight 3. Transport Aircraft Design Considerations and Requirements 4. Vehicle Options: driving...
使用实现一个朴素的蚁群聚类算法。 关于 这是一个简单的蚁群聚类算法的简单实现。 “天真”,因为在这个版本的算法中,蚂蚁不会留下信息素痕迹。 这个项目是在我攻读计算机科学硕士学位期间作为神经网络和知识发现...
Mason, Mason.js for creating a perfect grid with jQuery.
极性反转层厚度剪切模态压电谐振器的Mason等效模型,马廷锋,谢超,作为一种新型的压电器件优化技术,极性反转层技术在伸缩模态超声换能器中得到成功应用。然而,极性反转层对工作在厚度剪切模态的
使用makefile来构建项目。 要使用默认情况下以可视化为例的三个示例(如果您不想看到可视化,只需在GUI中将其禁用): $ start / mason.sh 或直接在不使用GUI的情况下启动示例模型: $ java sim.app.flockers....
本书通过将每一章编织成三个主题来向明天的商业领袖们介绍管理原则:战略,企业家精神和积极领导。
这是我在Mason中使用的工具的集合。 声明的属性:整齐地设置参数类的属性的方法 TitledSimpleInspector:外观更漂亮的检查器,允许标题和节 DataCollector:一个实用程序类,可收集数据并可以整齐地检查 ...
assignment2_mason
Laravel开发-mason-laravel 用于构建Mason超媒体API的Laravel和Lumen工具包
然后,您可以使用mason make生成第一个文件: $ mason make hello 命令行变量 任何变量都可以作为命令行参数传递。 $ mason make hello --name Felix 可变提示 任何未指定为命令行参数的变量都会被提示
Yu-Mason-hw5.zip
该项目包括两个版本,第一个是使用 MASON 工具包开发的,第二个是 DMASON 中的 MASON 分布式版本。 该项目需要提供的 MASON 工具包,用于其顺序版本。 对于它的分布式版本,它需要提供的 D-MASON。 在下载部分,您...