944,093 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Marked Solved
  • Views: 6527
  • ASP RSS
May 8th, 2006
0

Uploading images on a server

Expand Post »
hi
can anyone give me an asp code for uploading images on a server.
Have been trying the code on free asp upload but am getting a message that the directory in whicj i want to upload does not exist where as it do exists.
When i remove read only properties from the directory then it too mauch time and the page does not even appear.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
prats_20 is offline Offline
3 posts
since Apr 2006
May 9th, 2006
0

Re: Uploading images on a server

0 then 'Destination is specified. check its validity. ''''' fDestination = clng(fDestination) ''''' if fDestination>=0 and fDestination0 then if len(DestinationPath) > 0 then Form.Files.Save DestinationPath response.redirect("Videouploaded1.asp") response.write "
Files (" & Form.TotalBytes \1024 & "kB) was saved to " & DestinationPath & " folder." else response.write "
Bad destination path." end ifElseIf Form.State > 10 then Const fsSizeLimit = &HD Select case Form.State case fsSizeLimit: response.write "
Source form size (" & Form.TotalBytes & "B) exceeds form limit (" & Form.SizeLimit & "B)
" case else response.write "
Some form error.
" end SelectEnd If'Form.State = 0 then%> Select VideoName(Select) File 1 :


Video Description :




//Expand form with a new File fields if needed.var nfiles = 3;function Expand(){ nfiles++ var adh = '
File '+nfiles+' : '; files.insertAdjacentHTML('BeforeEnd',adh); return false;}This is one of my page that i used for Image uploading to server..if u want more details u contact me on the Mail : radha_992@yahoo.co.in
Reputation Points: 10
Solved Threads: 1
Newbie Poster
radharadha is offline Offline
6 posts
since May 2006
May 9th, 2006
1

Re: Uploading images on a server

This is one of my page that i used for Image uploading to server..if u want more details u contact me on the Mail : radha_992@yahoo.co.in

<%
'Stores files to the clients specified destination folder
'Client can choose folder from a dropdown
'Remember that ther is NO good idea to let clients store files in ANY folder!
Dim DestinationsToChoose, cDest
'DestinationsToChoose = Array("c:\upload", "d:\inetpub\data1", "f:\store")
DestinationsToChoose = Server.MapPath("Images/")
'Create upload form
'Using Huge-ASP file upload
'Dim Form: Set Form = Server.CreateObject("ScriptUtils.ASPForm")
'Using Pure-ASP file upload
Dim Form: Set Form = New ASPForm %><!--#INCLUDE FILE="_upload.asp"--><%
'Server.ScriptTimeout = 2000

Server.ScriptTimeout = 3000
Form.SizeLimit = &HA00000
If Form.State = 0 Then 'Completted
Dim DestinationPath, fDestination
dim videoname,VName,v
videoname=Form("video")
VName=Form("T1")
v="Images/" & VName
'response.write(vname)
dim D1
D1=Form("txtFrom")
dim rsCheck
set rsCheck=mycon.execute("select * from CategoryDetails where Id="& videoname &"")
if not rsCheck.eof then
dim video
video="Images/" & rsCheck(2) & ".MP4.2"
mycon.execute("update CategoryDetails Set Video1='"& v &"',D1='"& D1 &"' where Id="& videoname &"")
else
response.redirect("notAssigned1.asp")
end if
rsCheck.close

'read destination index
'''''fDestination = Form("fDestination")
'''''if len(fDestination)>0 then
'Destination is specified. check its validity.
''''' fDestination = clng(fDestination)
''''' if fDestination>=0 and fDestination<=ubound(DestinationsToChoose) then

'''''DestinationPath = DestinationsToChoose(fDestination)
DestinationPath = DestinationsToChoose

''''' end if
''''' end if'if len(fDestination)>0 then
if len(DestinationPath) > 0 then
Form.Files.Save DestinationPath
response.redirect("Videouploaded1.asp")
response.write "<br><Font Color=green>Files (" & Form.TotalBytes \1024 & "kB) was saved to " & DestinationPath & " folder.</Font>"
else
response.write "<br><Font Color=red>Bad destination path.</Font>"
end if
ElseIf Form.State > 10 then
Const fsSizeLimit = &HD
Select case Form.State
case fsSizeLimit: response.write "<br><Font Color=red>Source form size (" & Form.TotalBytes & "B) exceeds form limit (" & Form.SizeLimit & "B)</Font><br>"
case else response.write "<br><Font Color=red>Some form error.</Font><br>"
end Select
End If'Form.State = 0 then
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//<HTML><HEAD>
<TITLE>ASP huge file upload - upload to a specified destination.</TITLE>
<STYLE TYPE="text/css"><!--TD {font-family:Arial,Helvetica,sans-serif }TH {font-family:Arial,Helvetica,sans-serif }TABLE {font-size:10pt;font-family:Arial,Helvetica,sans-serif }--></STYLE>
<meta name="robots" content="noindex,nofollow">
</HEAD>
<BODY BGColor=white>

<Div style=width:600>
<TABLE align=center cellSpacing=0 cellPadding=0 width="40%" border=0>

<TR>

<TD>&nbsp;</TD></TR></TABLE>
<TABLE align=center cellSpacing=2 cellPadding=1 width="40%" border=0>

<TR>
<TD colSpan=2>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<br>Upload timeout is <%=Server.ScriptTimeout%>s
<br>Form size limit is <%=Form.SizeLimit \ 1024 %>kB
</P>
</TD></TR></TABLE>
<TABLE align=center cellSpacing=1 cellPadding=8 bordercolor=silver bgcolor=GAINSBORO width="70%" border=1>
<form method="POST" ENCTYPE="multipart/form-data" name=f onSubmit="return upload()">
<tr><td>

</td><td>
<!--
<Select Name=fDestination>
-->
<%
'Dim lDestinationsToChoose
'For lDestinationsToChoose=0 to ubound(DestinationsToChoose)
' response.write "<OPTION VALUE=" & lDestinationsToChoose & ">" & DestinationsToChoose(lDestinationsToChoose)
'next
%>
<!--
</Select>
-->
</td></tr>
<tr><td>
Select VideoName
<select name=video><option value=(Select)>(Select)
<%
dim rsFeed
set rsFeed=mycon.execute("select * from CategoryDetails")
while not rsfeed.eof
response.write("<option value="& rsFeed(0) &">"& rsFeed(2) &"")
rsFeed.movenext
wend
%>
</select>
</td></tr>
<tr><td ColSpan=2>
<Div ID=files>
File 1 : <input type="file" name="File1" style="font-size: xx-small; height:20; width:250; border-width:1px"><input Name=SubmitButton Value="Upload Video &gt;&gt;" Type=submit style="font-size: xx-small; height:20; width:100; border-width:1px"><br>
<input type=hidden name=T1>
<br><br>
Video Description : <br><br>
<textarea rows=15 cols=45 name=txtFrom></textarea>
<br>
<br>

</Div>
<!--
<Input Type=Button Value="Add a file" OnClick=return(Expand())
Style="border=0;background=yellow;cursor:hand"><br>
-->
</td></tr>

<tr><td >
<!--
<input Value="Submit" Type=submit style="font-size: xx-small; height:20; width:100; border-width:1px"><br>
-->
</td></tr>
</form></Table>
</form>
<Script>
//Expand form with a new File fields if needed.
var nfiles = 3;
function Expand(){
nfiles++
var adh = '<BR> File '+nfiles+' : <input type="file" name="File'+nfiles+'">';
files.insertAdjacentHTML('BeforeEnd',adh);
return false;
}
</Script>
</td>
</tr>
</table>
</td>
</tr>
</table>
Reputation Points: 10
Solved Threads: 1
Newbie Poster
radharadha is offline Offline
6 posts
since May 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: ASP Query
Next Thread in ASP Forum Timeline: Debug Activex dll from asp





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC