从表单中获取字段的值 - VBscript

时间:2014-08-14 14:05:17

标签: asp.net forms variables vbscript

我刚刚从github下载了一个.net图片上传器,但是因为它仍然可以获得它所带来的所有设置,所以每个上传的图像都被命名​​为相同,因此每张图片都会覆盖最后一张。

当这是现场时,我希望图像由单个项目的标题和艺术家命名。

我对.net没有多少经验,通常使用asp我会请求(" fieldname")并将其传达,但这不起作用

所以我的问题是,如何获取该字段的价值" thisuser"从表单中追加" upload_original"和" upload_thumb"上面代码中的变量?

我尝试将此用户调整为整数,以及其他一些内容,但由于我不熟悉.net,因此不断出现错误。

以下代码:

<SCRIPT LANGUAGE="VBScript" runat="server">
const Lx = 200  ' max width for thumbnails
const Ly = 240  ' max height for thumbnails
const upload_dir = "upload_resize_test/"    ' directory to upload file
const upload_original = "sample"    ' filename to save original as (suffix added by script)
const upload_thumb = "thumb"    ' filename to save thumbnail as (suffix added by script)
const upload_max_size = 2000    ' max size of the upload (KB) note: this doesn't override any server upload limits
dim fileExt ' used to store the file extension (saves finding it mulitple times)
dim newWidth, newHeight as integer ' new width/height for the thumbnail
dim l2  ' temp variable used when calculating new size
dim fileFld as HTTPPostedFile   ' used to grab the file upload from the form
Dim originalimg As System.Drawing.Image ' used to hold the original image
dim msg ' display results
dim upload_ok as boolean    ' did the upload work ?
</script>

它来自字段及其值的形式我想附加到文件名(upload_original和upload_thumb _

<form enctype="multipart/form-data" method="post" runat="server">
<table>
<tr><td>Select the file to upload:</td><td><input name="thisuser" id="thisuser" type="hidden" value="123"><input type="file" name="upload_file"></td></tr>
<tr><td colspan=2>Max upload size <%=upload_max_size%>Kb, gif/jpg/png only</td></tr>
<tr><td colspan=2><input type="submit" value="Upload"></td></tr>
</table>
</form>

当然有更多的代码,但我认为它没有相关性,也不想堵塞帖子!

非常感谢

1 个答案:

答案 0 :(得分:0)

Request.Form("FieldName")用于获取表单字段的值。