I need a help to fill FileUpload Default file path using C# code
here is a file path Server.MapPath("~/DemoTrack/DemoWorkout.mp4");
which i want to fill in FileUpload by code of C# if the FileUpload value is null. in asp.net
please let me know how can I fill the FileUpload by code
I'm doing this
FileUploadDemoVideo.SaveAs(Server.MapPath("~/DemoTrack/DemoWorkout.mp4"));
FileUploadAudio.SaveAs(Server.MapPath("~/DemoTrack/DemoTrack.mp3"));
String DfileExtension =
System.IO.Path.GetExtension(FileUploadDemoVideo.FileName).ToLower();
String AudioExtension = System.IO.Path.GetExtension(FileUploadAudio.FileName).ToLower();
i want to FileUploadDemoVideo and FileUploadAudio by code this is a file path Server.MapPath("~/DemoTrack/DemoWorkout.mp4") which i want to fill in FileUpload with a code wright in c# i just want to fill a FileUpload control then i can get a fileName and Extension so can convert in a Default value in byte[] and store that byte in sql data base if use didnt select the any file using FileUpload the Default value audio and video byte will be saved in database. as per that file which i fixed for audio and video.
I want to add a fix audio and video fill url in both audio and video FileUpload control with the code.
According to my understanding, you want to save the default audio & video, if there is no input from the user. If this is the case, you can directly save the file onto database without involving your file-upload control. Filling the default file path on the file-upload control doesn't make any sense on client machine, since your default contents resides on server.
Related
Can anybody help me to upload an image programmatically into a media picker in Umbraco 7 back office content page.
I have added the user submitted images into the media library. Also I can upload the images to an "upload" property type in the same content page. But as I am a newbie with Umbraco. I dont know how to add images to media picker. I am following MVC format.
Any help would be appreciated.
Finally I got it after some trial and runs. It was so simple.
Just assign the created media Id into the corresponding property value of page.
Like following:
doc.getProperty("image").Value = media.Id;
And if you need to add more than one items then:
Iterate each media IDs and make a comma separated string
imgIdList = imgIdList + "," + medid.Id;
then assign the comma separated string to the property value.
doc.getProperty("image").Value = imgIdList;
Hopes it will help somebody who are having the same problem
I have stored my image in database as format, how do i retrieve the image to imagefield without using gridview or datalist? I just want to retrieve it to the imagefield only
You can use the httphandler to retrieve the binary image, and then bind it to one image contorl with src property. Check this link.
http://forums.asp.net/t/1824646.aspx/1
I don't want save image in database. My application going to work on different shops i want show their logos on report.rdlc. For that i want to know, can i show image on report.rdlc by using path of image only? I tried to create parameter for Report.rdlc in ReportData but there is not any image Datatype.
Yes, you can:
Set image Source to External
Set image Value to an URL or file path
Set EnableExternalImages=true in your report code
You can also refer to http://msdn.microsoft.com/en-us/library/ms251715(v=vs.80).aspx for some additional info, but those steps above must be enough.
If any user gives the information of his photo in binary objects how can i search it and how can i display the corresponding image that was stored in the sql database
I will suggest to create a CRC/Hash of the Image File and then just search for this number. If you found it then compare the full Binary Format to be 100% that is the same.
To display the image I suggest to create an .ashx handler, that you send the ID of the image encrypted, then inside the handler you read the Image from the database and send to an img anchor.
eg.
<img src="MyImageHandler.ashx?Id=7738akj12391723">
I found some existing examples for display the image from the Database
http://www.aspfree.com/c/a/ASP.NET/Retrieving-Images-from-a-Database--C---Part-II/
http://csharpdotnetfreak.blogspot.com/2009/07/display-images-gridview-from-database.html
Its the same as I say...
I have table which stores entire XML file in a column. I want to show that column's stored value (ie. XML ) in web-browser using C#.
Please help/suggest some way to implement this. The trick is to retrieve the column and need to be displayed in webbrowser control.
Please suggest.
Thanks,
Karthick
For the record, here is the solution you decided to use:
Retrieve the column from SQL server
Write the XML to a file using StreamWriter
Navigate to that XML Path using the WebBrowser control.