i have a shop that needs to upload images. i have all the code ready
for upload and image resizing. however, i need to do it like this. on
the product submit page.. a link that says upload image with
TEXTFIELD1 beside it. you click the upload link and it opens
upload.asp in a new browser window. This file has a FILEFIELD so the
user can browse for a picture. my code will upload images and resize
them in upload.asp. NOW..i need to know..what do i need to add to my
code so that when the image upload and resize is complete, the user
can click a
CLOSE link and the FILEFIELD (which will aready contain the image file
name in the field) will then pass the name of the file to the original
product insert page and put this image file name into TEXTFIELD 1....
that products page will then be able to insert all product information
into the database since the files will already be on the server.
THANKS!
here is the code for upload.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/ncshoes.asp" -->
<!--#include file="../ScriptLibrary/incResizeAddOn.asp" -->
<!--#include file="../ScriptLibrary/incPureUpload.asp" -->
<%
'*** Pure ASP File Upload 2.1.3
Dim GP_uploadAction,UploadQueryString
PureUploadSetup
If (CStr(Request.QueryString("GP_upload")) <> "") Then
Dim pau_thePath,pau_Extensions,pau_Form,pau_Redirect,pau_storeType,pau_sizeLimit,pau_nameConflict,pau_requireUpload,pau_minWidth,pau_minHeight,pau_maxWidth,pau_maxHeight,pau_saveWidth,pau_saveHeight,pau_timeout,pau_progressBar,pau_progressWidth,pau_progressHeight
pau_thePath = """images"""
pau_Extensions = "GIF,JPG,JPEG,BMP,PNG"
pau_Form = "form1"
pau_Redirect = ""
pau_storeType = "file"
pau_sizeLimit = ""
pau_nameConflict = "uniq"
pau_requireUpload = "true"
pau_minWidth = ""
pau_minHeight = ""
pau_maxWidth = ""
pau_maxHeight = ""
pau_saveWidth = ""
pau_saveHeight = ""
pau_timeout = "600"
pau_progressBar = "blueFlashProgress.htm"
pau_progressWidth = "300"
pau_progressHeight = "100"
Dim RequestBin, UploadRequest
CheckPureUploadVersion 2.13
ProcessUpload pau_thePath,pau_Extensions,pau_Redirect,pau_storeType,pau_sizeLimit,pau_nameConflict,pau_requireUpload,pau_minWidth,pau_minHeight,pau_maxWidth,pau_maxHeight,pau_saveWidth,pau_saveHeight,pau_timeout
end if
%>
<%
' *** Smart Image Processor 1.1.1
If (CStr(Request.QueryString("GP_upload")) <> "") Then
Dim RUF_Component, RUF_DotNetResize, RUF_ResizeImages,
RUF_AspectImages, RUF_maxWidth, RUF_maxHeight, RUF_Quality,
RUF_MakeThumb, RUF_AspectThumb, RUF_Suffix, RUF_maxWidthThumb,
RUF_maxHeightThumb, RUF_QualityThumb, RUF_RedirectURL
RUF_Component = "AUTO"
RUF_DotNetResize = "../ScriptLibrary/ResizeImage.aspx"
RUF_ResizeImages = true
RUF_AspectImages = true
RUF_maxWidth = "600"
RUF_maxHeight = ""
RUF_Quality = "80"
RUF_MakeThumb = true
RUF_AspectThumb = true
RUF_Suffix = "_small"
RUF_maxWidthThumb = "100"
RUF_maxHeightThumb = ""
RUF_QualityThumb = "70"
RUF_RedirectURL = ""
if RUF_ResizeImages then
ResizeUploadedFiles RUF_Component, RUF_DotNetResize, pau_thePath,
"", RUF_maxWidth, RUF_maxHeight, RUF_Quality, true, pau_saveWidth,
pau_saveHeight, RUF_AspectImages, pau_nameConflict
end if
if RUF_MakeThumb then
ResizeUploadedFiles RUF_Component, RUF_DotNetResize, pau_thePath,
RUF_Suffix, RUF_maxWidthThumb, RUF_maxHeightThumb, RUF_QualityThumb,
false, pau_saveWidth, pau_saveHeight, RUF_AspectThumb,
pau_nameConflict
end if
if RUF_RedirectURL <> "" then
Response.Redirect RUF_RedirectURL
end if
end if
%>
<%
Dim rsUpload
Dim rsUpload_numRows
Set rsUpload = Server.CreateObject("ADODB.Recordset")
rsUpload.ActiveConnection = MM_ncshoes_STRING
rsUpload.Source = "SELECT * FROM products"
rsUpload.CursorType = 0
rsUpload.CursorLocation = 2
rsUpload.LockType = 1
rsUpload.Open()
rsUpload_numRows = 0
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script language="javascript"
src="../ScriptLibrary/incPureUpload.js"></script>
</head>
<body>
<br>
<font size="4" face="Verdana, Arial, Helvetica,
sans-serif"><strong>UPLOAD FILE
:</strong></font> <br>
Click browse and select and image from your computer.<br>
Then hit the Upload Image button and a thumnail and resized image will
be created.
<form action="<%=GP_uploadAction%>" method="post"
enctype="multipart/form-data" name="form1"
onSubmit="checkFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',true,'','','','','','','');showProgressWindow('blueFlashProgress.htm',300,100);return
document.MM_returnValue">
<input name="file" type="file"
onChange="checkOneFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',true,'','','','','','','')">
<br>
</form>
<input type="submit" name="Submit" value="Upload Image">
</body>
</html>
<%
rsUpload.Close()
Set rsUpload = Nothing
%> |