Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Dear All,

Please help I had gone through this article.
https://www.aspsnippets.com/Articles/Create-Add-Watermark-Text-to-Images-Photo-in-ASPNet-using-C-and-VBNet.aspx

How can I change from fileupload1 to Image1
Dim fileName As String = Path.GetFileNameWithoutExtension(FileUpload1.PostedFile.FileName) + ".png"


Dim fileName As String = Path.GetFileNameWithoutExtension(Image1.ImageUrl) + ".png"
System.ArgumentException: Parameter is not valid.


Thanks

What I have tried:

Dim fileName As String = Path.GetFileNameWithoutExtension(Image1.ImageUrl) + ".png"
System.ArgumentException: Parameter is not valid.
Posted
Updated 15-Jul-20 3:57am
Comments
Richard MacCutchan 14-Jul-20 3:27am    
Ask the person who wrote the article.

1 solution

Path.GetFileNameWithoutExtension does not expect a url, which is what you are passing it. You need to pass in just the image name. But if you do that and then add .png back on that seems pretty pointless.

You could just get the last part of the image url, such as shown here Get last part of URL after last slash | The ASP.NET Forums[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900