I am uploading member's picture into my database. However, there are instances that the member will not upload its photo. In this case, I'd like to upload instead a picture that is stored in my web app's folder. How am I going to get the picture and store it in my database.
I have a Report a Bug page added to a small site; I have a text box where a user can type a text that will be submitted to a table in my db; how do I implement the upload of a picture, let's say a screen capture? the most convenient way (for the user) would be to be able to press the Print Scrn button and then paste it to my text box ... well, I'm sure this won't work ...
I want to add picture to my SQL database using file Upload control but I don't know which attribute should I use also I don't know how to add it in the stored procedure,
In order to avoid having to pass Data that goes in the master page of my site before every view in every controller I have created an ApplicationController that sets the data on its constructor... the problem with this approach is that one of the viewdatas I must pass is the url of the profile Image of the current logged in user.
[Authorize(Roles = "Administrator")] public abstract class AdministratorController : Controller { private IPortalAdministratorServices _servicioPortalAdministrator; public AdministratorController() { _servicioPortalAdministrator = new PortalAdministratorServices(); ViewData["associates"] = _servicioPortalAdministrator.getAssociates(); ViewData["picture"] = _servicioPortalAdministrator.GetPic(); public AdministratorController(IPortalAdministratorServices service) { _servicioPortalAdministrator = service; } }
and so my companies Controllers wich inherits from AdministratorController now doesnt have to set all that Data upon every View Call.
[Authorize(Roles = "Administrator")] public class CompaniesController : AdministratorController { private ICompaniasServices _service; public CompaniesController() { _service = new CompaniasServices(new ModelStateWrapper(this.ModelState)); } public CompaniesController(ICompaniasServices service) { _service = service; }
The problem is this: When I try to manually access the Companies Controller without actually being logged in the method GetPic() wont actually be able to get the picture url cause no one is logged in.. and these method is getting called in spite of the Authorize attribute....so now, even after being logged in the ViewData for the picture url has been permanently set to "unknown.png" Some of this code isnt mine.. I just discovered the bug but cant figure out how to fix it.
I have a program where the user can do the following
1. Browse to an image
2. Click on the Preview button to view the image
3. Click on the upload button
When the user clicks on the PReview button I am storing the path to the image in a Session variable since the path is lost and then when the user clicks on the upload button then I am grabbing that value from the Session value however I realize that this is not the best way. the user could change his mind and start over again but the session value would have the old image.
I would like to use viewstate but I am using this in a child page of a master page and no form exists?
so the question I have is are you able to use viewstate in a content page like this?
For the upload control I need to fill in the path to the image when it's cleared out after step 2. When the user cliks on the Preview button this value is erased on the page.
I'm trying to display the picture that i have saved using the fileUploadControl functions. so far my code can save the picture to the folder that I want but the picture does not appear on my webpage. I used the code at visual studio 2005 and it works totally find but when I put it at visual studio 2008 it doesn't work fully. can somebody teach me how to solve this problem?? is there a new updates at visual studio 2008 that i missed??
i have two types of role, Member and Staff, i also include profile property for both role
My problem is, I'm now unable to assign Member to the newly registered user, I forgotten what i had modify but last time I can do that without any problem.
Im unable to assign member to registered user is because when i login using the registered account, the LoginTemplate switch to a normal LoggedInTemplate instead of Member logged in template that allow member to access to their own page
But on the other hand, i can register my staff, login and access staff page without any problem
am trying to use the AsyncFileUpload control in ajax toolkit to upload a picture file, save the file on a location on the server's filesystem and display the picture file back to the client system. I have both the image and AsyncFileUpload controls inside an updatepanel but its seems the UploadedComplete server code is not firing when the file upload completes any clue?
im trying to update a movie picture using file upload control that is located under an update panel but nothing seems to get updated, is there anyway that the update panel is giving me this mess cuz i have tryd everything nothing seems to work only if its with an update panel ..
I am trying to do some code where a user will be able to upload a .JPG picture from the users computer. I have put the controls and also written the C# code wich in my eyes seems to be correct. What happens in the code is that the uploaded picture will replace the existing "TopHeader.JPG" picture.
However when I run the code after I have choosen a .JPG picture from the desktop on my computer. Nothing happens except of a postback of the page.
I wonder what I can be missing out in order to make this work. (I attach both the HTML code and the C# code, I will be happy to know what I could be missing out)
I was just wondering if anyone has ever had to port the schema across? Are there any experts that could pitch their opinions on the achievability of this (mad) idea? I'm using the IBM Migration Toolkit and as expected its throwing a bunch of translation errors some of which were relatively easy to solve (vendor specific function calls for example) and some will take quite a while to pin down and work round.... however this is not my main concern.
If completed I expect I am going to have to basically rework all the System.Web.Profile/Roles/Membership namespace classes etc to work round the SQL limitations of informix (i.e. IDS11.x SQL server doesnt have a DEFAULT (newguid()) so that would have to be put into the calling method) (and any MVP comments really as I can slap my boss round with the weight after he ludicrously agreed to this project for a client without doing any research...)
i am trying to upload files through the ASP.NET File Upload control.
Every thing is working fine, except for the fact that when i try to upload the file on the server i am getting an error: (probably some authorization exception).
do i need to give some rights to the upload up there on the server. If so then for which account and do i need to restart the server after giving rights?
I have two member roles at my project: 1.) Administrator 2.) Member
From the toolbox in Visual Studio 2008, I have dragged and dropped the create user wizard into the stage. I aim that a guest can register itself and automatically join the "member" role. Not the role "administrator". How can I do that?
public class WebModel { public List<ArticleModel> Articles { get; set; } } public class ArticleModel { public int ID { get; set; } public double ValueParam { get; set; } }
Then I have the controller with the two actions:
[Authorize] public ActionResult Index() { WebModel model = new WebModel(); ModelConverter.ConvertToModel(model, controller); return View(model); } [Authorize] [HttpPost] [ValidateInput(false)] public ActionResult Index(WebModel model, string saveButton) { ModelValidation.ValidateWebModel(model, ModelState); if (ModelState.IsValid) { return RedirectToAction("Create", "Article"); } ModelConverter.ConvertToModel(model, controller); return View(model); }
If I press the submit button, I get to the second action method in the controller (the one with the HttpPost attribute). In this action, the object model itself is not null, but the "Articles" list inside is null.
I am inserting a picture into a database, using the following code.
strFileType = Path.GetExtension(filImage.PostedFile.FileName).ToLower(); switch (strFileType) { case ".gif": strMimeType = "image/gif"; break; case ".jpg": case ".jpeg": case ".jpe": strMimeType = "image/jpeg"; break; case ".png": strMimeType = "image/png"; break; } //Store the content length int iDocLength = filImage.PostedFile.ContentLength; byte[] bDocBuffer = new byte[iDocLength]; //Get stream object Stream streamImage; streamImage = filImage.PostedFile.InputStream; streamImage.Read(bDocBuffer, 0, iDocLength); cmPerson.CommandText = "INSERT INTO photos VALUES(@referenceid, @image, @imgtype)"; cmPatient.Parameters.AddWithValue("@referenceid", iPersonID.ToString("000000")); cmPerson.Parameters.AddWithValue("@image", bDocBuffer); cmPerson.Parameters.AddWithValue("@imgtype", strMimeType); cmPerson.ExecuteNonQuery();
If in case that the user, did not browser for a picture, then, I have to use the nopho.jpg that is stored in the images/folder of my web app. How am I be able to do this?
I have a picture that i would like to upload to a database. I am really new to this so i am not sure what to do. I have been using the following code below to upload and retrieve the picture, looks like its uploading ok, but i cant retrieve it. The code i am using comes from this site,
i use visual studio 2010 i have stored image into sql server in binary format and how to retrive that image(which is in binary format) and display in image contro