473,320 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

upload image

G
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.
Mar 23 '07 #1
2 4774
"G" <su**********@gmail.comwrote:
>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)
Sl********@bls.gov
http://members.cox.net/slatteryt
Mar 23 '07 #2
"G" <su**********@gmail.comwrote in message
news:ut**************@TK2MSFTNGP03.phx.gbl...
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/>");
}
}
%>
Mar 23 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
0
by: SEMIH DEMIR | last post by:
Sitelerden birinde verilen yabancı kaynakli bir scriptti duzenledim yanlız birseyin içinden bir turlu cıkamadım işin aslı ilk defa persistin upload componentini kullanacam yanlız suanki haliyle...
4
by: Jim Michaels | last post by:
after a file upload, $_FILES is not populated but $_POST is. what's going on here? $_POST=C $_POST=C $_POST=C $_POST=C:\\www\\jimm\\images\\bg1.jpg $_FILES= $_FILES= $_FILES=
9
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
3
by: kksandeep | last post by:
i am using this three files to uplod file. i got this file from net but i think these have some error. i am new to this field plz help the script i found is some helpful but not too that i need ...
1
by: kksandeep | last post by:
i am using this three files to uplod file. i got this file from net but i think these have some error. i am new to this field plz help the script i found is some helpful but not too that i need ...
7
by: xx75vulcan | last post by:
Hi, I've got a PHP Upload Form that works great, unless that is, the image your uploading has been modified through a photo editing software. Example: if I upload the image straight from a...
7
by: mishrarajesh44 | last post by:
hii all Truly telling i hav got this code from net & i am finding error while running the code below.. code:- <?php $idir = "photo/"; // Path To Images Directory $tdir =...
1
by: chennaibala | last post by:
can any one send me mutiple image upload program and save the file name with extension in mysql table.we must cheak uploaded file type like bmp or any image file while uploading. i develop...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.