Link to home
Start Free TrialLog in
Avatar of Tony Owers
Tony Owers

asked on

Upload Image with Resize.. ASP Classic

I am using asp classic and freeASPupload to up load my files, i am also using highslide to resize on display,

i need to resize on upload, i have read there is a way to use highslide in conjunction with freeASPupload to do this but cant get it to work..

any help will be appreciated ty
Avatar of leakim971
leakim971
Flag of Guadeloupe image

posting your full code with your best try would be awesome
Avatar of Tony Owers
Tony Owers

ASKER

i have no code, nothing i tried worked so havnt kept any of the code created sorry
nothing i tried worked

I'm talking about this "nothing"? Could you post it?
at least your current page with the fields?
the form to upload image

<div style="position: absolute; top:120; left: 210;">
    <form name="frmSend" method="POST" enctype="multipart/form-data" accept-charset="utf-8"  onSubmit="return onSubmitForm();">
<input type="hidden" value="islogo" name="logo">
   <input style="position: relative; left: 5;" name="attach1" type="file" size=10>
 <input style="position:  relative; top:-20; left: 150;" name='logoupdate' type=submit value="Upload">
    </form>
    </div>

Open in new window


the code for collecting and saving the data

function SaveFiles
    Dim Upload, fileName, fileSize, ks, i, fileKey, thisFilename, isLogo, thistitle, isDetail, isPDF, thisManual, redirectPage, FileType


    Set Upload = New FreeASPUpload
    Upload.Save(uploadsDirVar)

	' If something fails inside the script, but the exception is handled
	If Err.Number<>0 then Exit function

    SaveFiles = ""
    ks = Upload.UploadedFiles.keys
    if (UBound(ks) <> -1) then
        SaveFiles = "<B>Files uploaded:</B> "
        for each fileKey in Upload.UploadedFiles.keys
		            SaveFiles = SaveFiles & Upload.UploadedFiles(fileKey).FileName & " (" & Upload.UploadedFiles(fileKey).Length & "B) "
		            thisFilename = htmlencode(Upload.UploadedFiles(fileKey).FileName)
		            isLogo = upload.form("logo")
		            equipID = upload.form("EqpID")
		            FileType = upload.form("FileType")
		            isDetail = upload.form("isdetail")
					thisComment = upload.form("comments")
		            thistitle = upload.form("imgTitle")
		            thisManual = upload.form("manual")
		            isPDF = upload.form("ispdf")


		            thisSQL = "LogoUpdate"
		            thisSQL = thisSQL & " '" & thisFilename & "', " & "'" & isLogo & "', " & "'" & FileType & "', " & "'" & equipID & "', " & "'" & thistitle  & "', " & "'" & thisComment & "', " & "'" & isDetail & "', " & "'" & isPDF & "', " & "'" & thisManual & "' "

			RunSP thisSQL,thisSQL
        next
    else
        SaveFiles = "No file selected for upload or the file name specified in the upload form does not correspond to a valid file in the system."
    end if
	SaveFiles = SaveFiles & "<br>Enter a number = " & Upload.Form("enter_a_number") & "<br>"
	SaveFiles = SaveFiles & "Checkbox values = " & Upload.Form("checkbox_values") & "<br>"
	SaveFiles = SaveFiles & "List values = " & Upload.Form("list_values") & "<br>"
	SaveFiles = SaveFiles & "Text area = " & Upload.Form("t_area") & "<br>"
	if isLogo = "islogo" then
	'response.write sScriptLocation
	Response.redirect sScriptLocation
	else
	'response.write sScriptLocation
	Response.redirect "/cmms/equips/edit_eqp_detail.asp?eqpid=" & equipID
	end if

end function

Open in new window

could you post this onSubmitForm function or just confirm you are not using ajax to send the form/image and you're as redirected to a new page at the end : /cmms/equips/edit_eqp_detail.asp?eqpid=
what do we have on this page ?
do we have the picture we just uploaded to be able to resize it ?
this is submmitted on this page

this line sends it to SP in sqlserver to save

RunSP thisSQL,thisSQL

Open in new window


the redirect is taking you back to the main image input page, this code also changes logo but logo can be changed from any admin page so handling code is in its own file.
OK, I believe the workflow is not nice to allow the resize
What you can do is :
1) use Ajax to send the file
2) your saving function/page need to send back the path to that picture as response
3) now you've the picture path,  you can display the picture
4) use a third party plugin to let the user resize the picture
5) when the user click update/save new size send the new size to a function/page with the path to the picture
i already resize on display, that isnt the issue i want to resize before its saved, images use too much hard drive space as most are mobile phone images and they are huge files
what does this mean?

This is an Apache Maven project, use "mvn clean install" to build the webapp and "mvn jetty:run" to run the app on

i use a windows server..
it's to build the java based demo
i have installed windows image resizer on my server, now looking for a way to make this function from a bat file so i can trigger a resize once its uploaded and move image to correct folder for display

Windows Image Resizer
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.