Trimming Filename
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.
View Replies
ADVERTISEMENT
I have a form that gets a filename from a db like so
<FORM METHOD="POST" encType="multipart/form-data" ACTION="pic_delete.asp">
<input type="hidden" name="File1" value="<%=rstemp("filename")%>">
<input type="hidden" name="ImageID" value="<%=rstemp("ImageID")%>">
<INPUT TYPE=SUBMIT NAME="cmdSubmit" VALUE="Delete" ></form>
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"
Upload.DeleteFile Folder & FileName
'Upload("File1").SaveAs Folder & FileName
Set Upload = Nothing %>
The folder name comes out right, just the filename changes.
View Replies
View Related
My record returns a numerical string "02". When I response.write it I want to remove the "0" ONLY from the beginnings. How would I do that?
View Replies
View Related
I know that trim removes white space and the LTrim and R trim removes space from the left or right but how would i trim a string after 20 characters so that i could add ... to the end of the new trimmed string???
View Replies
View Related
if i had a string which looked like this :
,apple, orange, grape, tomatoes
how do i remove the first character[,] from the string using the trim() function?
View Replies
View Related
i don't know what to do here exactly.
i have seen the TRIM function, but i'm not sure if it's the right way to do it.
i have a recordset called RSUSEREDIT.
in the recordset there is a column called "EMail".
i can print out the results using Code:
<%=RSUSEREDIT("Email")%>
the email column always uses the same domain name... - username@domain.com
is it possible to remove the part after and including the "@"?
View Replies
View Related
I'm dynamically building an SQL string to do an execute, and keep ending up with a leftover comma, so the string looks like this.
INSERT INTO Software ( Title, Version, Licensing, Total_Licenses, support_phone, support_email, Campuses_Licensed, Comments, support_web, FundingSource, Course_title, Subject, Grade_level, LocalExpert, ACTIVE, CATE, EntryDate,) VALUES ( 'Bob's Super Crappy Software', '4.3', 'labpack', '36', '555', '555', 'Alexander, Bilhartz, Central, Fairmeadows, Hyman, Daniel', 'James is testing this', 'www.bob.com', 'Campus PO', 'Math', 'Math', '4, 5, 6', 'Patrick Williams', '1', '0',)
Both commas are added dynamically and can be trimmed on the fly. I tried using RTRIM(strSQL, ",") but this didn't work.I put the fields into an array and tried to add only commas to all but the last entry, but that also didn't work.
View Replies
View Related
I have a database field that is a memo type. I would like to be able to only display the first 50 words from the database. I would like for it to show ..... after about 50 words.
I am using <%=Content %>. How do I trim this field to show only 50 words and then ....?
I tried the following code:
Function LengthTrim(input, length)
If Len(input) > length Then
Return Left(input, length) + "..."
Else
Return input
End If
End Function
then <%= LengthTrim(Content, 50) %>
But it would not work. I got the following error message:
Microsoft VBScript runtime error '800a01f4'Variable is undefined: 'Return' .
View Replies
View Related
Code:
StartTime = FormatDateTime((rs("startdate")),3)
this returns
7/4/2006 1:00:00 AM
I need to trim the seconds off so it looks like this
7/4/2006 1:00 AM
View Replies
View Related
I have a section on my website that lets users to input their own username and password in order to enter the restricted area, but i notice that some of the users likes to use strange characters to use as their username or password.
how could I trim those strange characters ie. like the follow !@#$%^&*()'{}/?~ out of the input field, WITHOUT using the javascript because javascript can be disabled from the browser and by only using the ASP IF ELSEIF statements to do so?
View Replies
View Related
I have an Access db of products which I'd like to use for creating dynamic urls. Each product has a range name which I intend to use to point to the folder containing the relevant image eg pine/001.jpg
My problem is one of the ranges has two names ie Indian Accessories. I can't have a url with a space in it so how can I dynamically alter the field so that it displays the url as either indianaccessories or indian-accessories?
View Replies
View Related
I need to trim a variable to have everything after 4 chars in a string.
IE:
var_temp = 200:16:1234567890
i want everything after 200: to be a variable.
I cannot use:
var_new = right(var_temp,14)
because the string is a different length everytime.
I just dont know this function.
View Replies
View Related
Someone should write a book Javascript for VBScript Programmers. I can't seem to find a native function in Javascript to trim a string. Is there one or does anyone have one handy?
View Replies
View Related
if i have a value of 11.7908787541713
how could i trim it to 11.79 and how do i round the number up?
View Replies
View Related
I am taking a field from a database and attaching it to avariable like so:
varID = rsCheckLogin("LogonID")
This is returning, for example, SA70.
I only need the integer part. How would i remove the SA part, i have belive it must be trim or split but not sure how to use them?
View Replies
View Related
i have a search page results what i want to do is trim the result to 100 chars either side of the matched word but say if the word is at the start or end just to trim 100 chars left or right. does anyone have a function that will do this ?
View Replies
View Related
if iam requesting a form field, how do i trim that to just the first 2 letters Code:
View Replies
View Related
I am trying to make a search page. Once a serach word or words is put in I need it to serach multiple product tables and output the description of any prioduct if the search word is present in the description.
However, If i put in 2 keywords like "paper sticker" I get no results. How do you search multiple keywords? Code:
View Replies
View Related
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.
View Replies
View Related
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?
View Replies
View Related
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:
View Replies
View Related
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.
View Replies
View Related
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?
View Replies
View Related
What string function(s) would I use to extract just the filename from an URL?
For example, if I have http://www.yourdomain.com/some_directory/some_file.asp, how do I extract just the "some_file.asp"?
View Replies
View Related
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?
View Replies
View Related
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?
View Replies
View Related
am trying to upload a file and at the time try to rename the file to autogenerated name.
View Replies
View Related
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.
View Replies
View Related
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?
View Replies
View Related
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:
View Replies
View Related
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"?
View Replies
View Related
Is there a way to automatically copy the filename of an uploaded file to a database field?
View Replies
View Related
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
View Replies
View Related