Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > upload image

Reply
Thread Tools

upload image

 
 
G
Guest
Posts: n/a
 
      03-23-2007
Hello Friend,

I am handling a module using ASP3.0 which has to upload an movie clipsof
size 1 mb or 2 mb. i have a code which upload only files or images. So I
need your help for this. If you know any code or any free component please
share with me.

Thanks
G.


 
Reply With Quote
 
 
 
 
Tim Slattery
Guest
Posts: n/a
 
      03-23-2007
"G" <(E-Mail Removed)> wrote:

>Hello Friend,
>
>I am handling a module using ASP3.0 which has to upload an movie clipsof
>size 1 mb or 2 mb. i have a code which upload only files or images. So I
>need your help for this. If you know any code or any free component please
>share with me.


http://www.Planet-Source-Code.com/vb...=7361&lngWId=4

--
Tim Slattery
MS MVP(DTS)
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://members.cox.net/slatteryt
 
Reply With Quote
 
 
 
 
Marc
Guest
Posts: n/a
 
      03-23-2007
"G" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello Friend,
>
> I am handling a module using ASP3.0 which has to upload an movie clipsof
> size 1 mb or 2 mb. i have a code which upload only files or images. So I
> need your help for this. If you know any code or any free component please
> share with me.
>
> Thanks
> G.


keep an eye out on the wrapping!


<!-- save everything below as: fileuploader42.asp -->

<form name="upload" action="fileuploader42.asp"
enctype="multipart/form-data" method="post">
<input type="text" name="title" size="42" value="ASP File Uploader 42 (c)
2004 by Q42 (www.q42.nl)" /><br/>
<input type="text" name="description" size="42" value="Multiple files and
fields uploading roundtrip in 1 file: 42 lines of javascript including error
handling, size delimiter and comments" /><br/>
<input type="file" name="file1" /><br/>
<input type="submit" value="Send" />
</form>
<%@ language="javascript" %>
<%
if (Request.TotalBytes == 0) Response.End;
// set maximum filesize to 1 Mb
var maxFileSize = 1024 * 1000;
// use recordset to cast binary to string, and split result on seperator
var recordSet = Server.CreateObject("ADODB.Recordset");
recordSet.fields.append(0, 201, Request.TotalBytes);
recordSet.open();
recordSet.addNew();
recordSet.fields(0).appendChunk(Request.binaryRead (Request.TotalBytes));
var data = new String(recordSet.Fields(0)).split((recordSet.Field s(0) +
"").substring(0, (recordSet.Fields(0) + "").indexOf("\r\n")));
recordSet.close();
// store values and files in different objects, so we can scan through
them later
var values = {};
var files = {};
for (var i = 1; i < data.length - 1; i++) {
var curdata = data[i].split("\r\n");
if ((curdata[2].length == 0) && (curdata[4].length == 0))
values[curdata[1].substring(38, curdata[1].length-1)] = curdata[3];
if ((curdata[2].length != 0) && (curdata[4].length != 0) &&
(data[i].length < maxFileSize))
files[curdata[1].replace(/.*filename=[\'\"](.*)[\'\"]/,
"$1").replace(/([^\\]+\\)+/,"")] = { contentType:curdata[2].substr(14),
fileData:curdata.slice(4, curdata.length - 1).join("\r\n")};
}
// scan through the names in the values object and show each corresponding
value
for (var fieldName in values) Response.Write(fieldName + " = " +
values[fieldName] + "<br/>");
// scan through the files object, store each file to disk, and show the
result (images show directly, other data show the contenttype as a hyperlink
to a popupwindow)
for (var fileName in files) {
try {
var fso = new ActiveXObject("Scripting.FileSystemObject");
var file = fso.OpenTextFile(Server.MapPath(fileName), 2, true);
file.write(files[fileName].fileData);
file.close();
Response.Write(fileName + " : <a href='"+fileName+"'
target='_new'><img align='top' src='"+fileName+"'
title='"+files[fileName].contentType+"' border=''
onerror='this.parentNode.innerHTML=this.title'/></a><br/>");
} catch(e) {
Response.Write("Error. Could not upload the file: " + fileName +
"<br/>");
}
}
%>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
File upload from client application (non-form based upload) stuart@microsoft.com Python 1 11-25-2006 12:14 AM
Upload a file without file Upload control - ASP.Net =?Utf-8?B?U2FyYXY=?= ASP .Net 3 08-03-2005 01:09 AM
wx.Image: Couldn't add an image to the image list. Laszlo Zsolt Nagy Python 1 01-26-2005 09:55 PM
How to detect sizeof upload in order to show status of browser file upload? Heather Fraser Java 0 07-05-2004 12:35 AM
Upload Excel with Macros using HTML File Upload Prakash ASP General 3 11-12-2003 04:26 AM



Advertisments