|
here is the code of my project
String path =Server.MapPath("~\\User Images\\");
String extention = Path.GetExtension(FileUpload1.FileName).ToLower();
if (extention == ".jpg" || extention == ".gif" || extention == ".jpeg")
{
FileUpload1.PostedFile.SaveAs(path + FileUpload1.FileName);
FileUpload1.Visible = false;
Button1.Visible = false;
ImageButton1.Visible = false;
//LinkButton1.Visible = false;
}
what i want is to save this image with a new name
|
|
|
|
|
here is the code of my project
String path =Server.MapPath("~\\User Images\\");
String extention = Path.GetExtension(FileUpload1.FileName).ToLower();
if (extention == ".jpg" || extention == ".gif" || extention == ".jpeg")
{
FileUpload1.PostedFile.SaveAs(path + FileUpload1.FileName);
FileUpload1.Visible = false;
Button1.Visible = false;
ImageButton1.Visible = false;
//LinkButton1.Visible = false;
}
what i want is to save this image with a new name
|
|
|
|
|
Please tell me someone is not paying for this code ?
If you step through this in the debugger, what do you see ? As far as I can see, this is going to save with the filename you passed in. Surely if you want to rename it, you can see how to do that ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
if u want to save the file with a new name but same extension, just manipulate the filename.
u can use the Split() function
Apurv
A man is but the product of his thoughts. What he thinks, he becomes.
.......Mahatma Gandhi
Be the change you want to see in the world.
.......Mahatma Gandhi
|
|
|
|
|
ya! but can you give me a bit more idea about it with my code
|
|
|
|
|
No, because what you want is not clear. I asked you what happens when you debug the code and you didn't answer. If you can't tell us what it is that this code does wrong, or how it behaves differently to what you expect, then how can we help you ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hello,
How to set background image of button or make it transparent in asp.net?
Is it possible?
Thanks
modified on Monday, December 22, 2008 12:43 AM
|
|
|
|
|
I believe there is an Image Button class built in.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi all,
How to retrieve request.querystring in hidden control.I need to do something like below.
<input type="hidden" name="FanID" value="<%=request.querystring["FanID"]%>"/>
Please Help.
Thanks a lot.
|
|
|
|
|
I believe the following will work
<input type="hidden" name="FanID" value='<%=request.querystring["FanID"]%>'/>
If not, mark it as runat=server and access from code behind file.
|
|
|
|
|
Thanks Navaneeth.It worked.
|
|
|
|
|
Why do you need something in a hidden control that's already on the query string ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hello,
I write a simple code to print a file through Microsoft Office Word in an ASP.NET page.
The problem is that every time I run the page, winword.exe is run by Network Service and is remained in task bar and nothing else.
(Ofcourse, I can run the full command line in RUN prompt, but in ASP.NET no!!!)
How I can fix this problem.
Best Reg
Ali
Code:
====================
Partial Class test_diag
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim psi As System.Diagnostics.ProcessStartInfo = New System.Diagnostics.ProcessStartInfo()
psi.FileName = "c:\Program Files\Microsoft Office\OFFICE12\WINWORD.EXE"
psi.Arguments = "C:\test\1.doc""/mPrintDefault /q /n"
System.Diagnostics.Process.Start(psi)
End Sub
End Class
====================
|
|
|
|
|
When you deploy this site, do you expect to print a document on the client end, or on the server ? Do you want the client to make your web hosts printer work, or to print something on their own machine ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
On the Server.
Web site visitor can upload his .DOC file to server. (WINDOWS 2003)
Then my page must print this doc file to default printer that is a PDF Printer.
Winword.exe is lunched. (It appears in Task Manager with associated user: NetworkService)
But it remains! No cpu process!
I changed permission of destination folder to FULL for IIS_WPS & NetworkService & IUSER & ASP.NET users. No Success!
Ali
|
|
|
|
|
Hi there, I'm facing a problem with limiting the file upload size in ASP.NET 2.0, or more specifically, by handling "file too large" errors.
I did the development & testing on a Vista Business / IIS 7, where I was able to handle the situation nicely using the Application_Error handler in global.asax. When the uploaded file size is larger than maxRequestLength, I just displayed a friendly error page with explanation. After deploying the application to the production server, which is running Windows 2003 R2 with IIS 6, I realized that this doesn't work. What's worse, in case the file is larger than the limit, it won't display any error message, IIS simply cuts off the connection and browsers display their own error message about the network connection being interrupted.
Is there any solution to this problem on IIS 6? All my googling points to websites suggesting the Application_Error handler, or eventually configuring a custom error page in IIS directly, but none of this will work if IIS 6 just cuts off the connection. Also, it does this right in the beginning - i.e. I try to upload a 4MB file and it cuts me off after 5 seconds, not after transferring 2MB (which is my current limit, note that the server is remote and I have 256kbit upload) so it must know about the filesize from the start.
I'd like to be able to handle this in a friendlier matter, in a simple way (i.e. handling in .NET code, or by configuring error page in IIS). I know that there are flash uploaders, etc, but those are out of question right now.
Any clues or ideas are highly appreciated!
Thanks,
Rado
|
|
|
|
|
Did you set the values in web.config for upload ?
|
|
|
|
|
But of course - as I said in my original post all works well on IIS 7. The maxRequestLength is set to 2048 (2MB) and executionTimeout to 2 minutes.
Thanks!
|
|
|
|
|
Hi, please try to extend the maxrequestlength in web.config to 5MB or greater, you can extend upto 2 GB for a 2.0 application. Please revert back if the problem still exists.
Thanks,
Rajdev
|
|
|
|
|
Thanks, but actually, I need to limit file upload size (and handle it in a friendly manner) that's why I set this to 2MB so this would not resolve anything. Btw I did not find any solution to this - it seems to me that it's not possible to handle this in IIS6, whereas it works nicely in IIS7.
|
|
|
|
|
Hi,
We have faced a similar issue and resolved it. Please find the instructions we followed to resolve. We have limited the upload size to 10MB and we are showing friendly message if the size exceeds. Please revert back if you still have the issue.Thanks.
Root Cause of the Issue
· IIS6 uses a new metabase property called UploadReadAheadSize when passing data to an ISAPI extension. This property is used to determine the maximum buffer size for the incoming request. The default size for this buffer is 48k
· If UploadReadAheadSize is smaller than the content length, an HTTP 413error is returned, and the connection is closed to prevent deadlock. This causes the “Page cannot be displayed” error in IE
Solution
· Change the value of UploadReadAheadSize to a value larger than the content length
· The following example shows how to set the value for UploadReadAheadSize to 200KB on the Web server
cscript adsutil.vbs set w3svc/1/uploadreadaheadsize 200
Source
http://technet.microsoft.com/en-us/library/cc737382.aspx
http://blogs.msdn.com/jiruss/archive/2007/04/13/http-413-request-entity-too-large-can-t-upload-large-files-using-iis6.aspx
Thanks,
Rajdev
|
|
|
|
|
my database is in ms-access i have column as date when i keep the the datatype as date/time of that column it shows the default time in gridview &details view as 12:00:00
how to remove this time as i am binding data through code
|
|
|
|
|
By writing code that provides a format string. We can't be more specific without knowing what your code looks like.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
avinash86 wrote: how to remove this time as i am binding data through code
For that you need to simply formating you date-time variable while showing on gridview.
As CG suggested , If you put your code over here then we can give the exact solution.
|
|
|
|
|
Hi all,
iam using ByDefault SMTP Server for sending email and iam using system.net.mail namspace(objects) for sending email .
Problem now is that the webapp says "Message Sent" when I send an email TO and FROM a Gmail account, or yahoo account but I never receive the email.
Is there a possibility that Gmail and yahoo doesn't allow email relaying or what else can I try? I am not receiving any error messages in my VB code or anywhere else.
what things iam missing guide me in this issue .
Best regards
Rameez
|
|
|
|