I have a form that will adding the product to the online store, and contains this many fields
1) Product Name
2) Product Code
3) Product Description
4) Product Price
5) Product Image
now i wanted that while user/admin select a image using file upload control of asp.net, after selecting product image that will be displayed in image control before the user will upload that to the server.
all i need is to preview that image before it will uploaded to the server, it will be by using any of these javascript, jquery, Ajax or c#
please help me...
Thank in Advance.
Tejas Vaishnav
C# executes on the server so the image has to be already there.
Javascript and jQuery run client-side so you could have more luck with these two ( in fact JQuery is just a JS library on top of the JS engine in the browser ).
Why don't you use the preview feature of the browser's open/select file dialog anyway?
You need a script that uses a dataURI for Gecko...
This may not work with default security from a web server but does work if you load the page from your harddisk
http://javascript.internet.com/forms/image-upload-preview.html
You cannot quiet possibly do it just using JavaScript unless you use Flash or some other ActiveX plugins. It is because you cannot access the client machines resources without permission due to security reasons. You can only upload on the server and preview it. Hope this makes sense to you.
Quick googling didn't show any promissing results (at least one working in cross-browser manner). Your best shot is using Flash (version > 10, since it was the first version that enables you to access local files picked by user). It can be simple Flash (or Flex) application, you can find many examples of manipulating/showing user selected files before sending them to the server. Here you can find example of such application (made by me). You can pick image from your local disk and it is displayed / can be manipulated all before uploading it to the server.
Check the simple example of previewing an image before uploading it (Flex)
Related
I've a C# WPF application developed in VS 2015, and I want the browser to read some data from it. Just a short string. I can save it in a text file, or in a variable but it should be visible to the browser (using JS I suppose). For instance using file:/// doesn't work if the original page is hosted online - as in my case (different source conflict). This should work in Opera and FFox, but looking at their extensions, it seems you can only develop with front-end technologies, which are not enough in my case since I use WPF to look into Win OS, and then I need to share the result with the browser.
I suspect it's possible, and no , it's not to write a malicious piece of code. For instance I can read the details of the graphic card for diagnostic purposes.
Please help, many thanks.
Browsers run in a security sandbox which is intended to stop them reading or writing files to the file system.
You could write to the user's appdata. There are various javascript frameworks which persist data to there so they can provide offline or static data.
I don't think that is a good plan though.
I suggest your first candidate would be a cookie.
Quick google on how to do that, I find:
How to create cookie in c#.net windows application?
From a web page you can use the content of a cookie dynamically. So you could change what you see in the web page after it's up and running from some process in your wpf app and do a counter or whatever.
I've not used this with windows apps and a browser but I have with a web app and Silverlight. I'm afraid I don't have that code to hand though.
I'm having issues with converting my Intranet Page to PDF file. I used 2 solutions which actually works, however with some issues.
Solution 1:
I used wkhtmltopdf.exe tool. I was able to make it work on my local machine.
However, when I deployed it to our Server, it stopped working until I notice that it's not working with intranet sites. When I tried extranet sites, it's working.
Solution 2:
I took an alternative solution by getting the HTML of that site, and let the wkhtmltopdf.exe tool to make it PDF which also works, however, the data on my page that I'm trying to convert to PDF is database driven. So all information including images was not supplied when it was converted to PDF.
Please help if there's a way to make the wkhtmltopdf.exe tool work in Intranet Sites(solution 1) or
how I can retrieve the whole page including data and images when converting it to PDF(solution 2)
Thank you very much!
it stopped working until I notice that it's not working with intranet sites.
That is not an exhaustive problem report. I have done it by rendering a view to a string and then converting that string to a pdf using wkhtmltopdf.
Rendering the view to a string: Render a view as a string
i did not include wkhtmltopdf direct, rather I used the tuespechkin nuget package: https://github.com/tuespetre/TuesPechkin
I would say to look at the permissions available. Intranet sites normally have different permission levels than a public facing site. It could be that the public facing sites have permissions that have been applied to the .exe such as the IIS_IUSR account to enable it to work with anonymous guest accounts, but lack the permissions needed in an intranet which often uses the domain user account of the logged in user to authenticate resources.
For whtmltopdf software to generate pdf on your intranet server, you need to have 2 files msvcp120.dll & msvrp120.dll in the same folder as wkhtmltopdf.exe file to running from server side. Hope this helps.
I have several input type files in my asp.net Web Form.
How can I upload files to Server using Jquery, AJAX and C#?
The uploaders are generated programmatically so I cannot upload the files using code behind.
Also, many files must be uploaded at once.
Is there anyway I read the file via Jquery, send it via AJAX to server and upload it there?
THanks
Have a look at Fine Uploader. It does not use flash or java. In fact, it does not have any required dependencies. An optional jQuery plug-in is provided, if you use jQuery though.
Support: IE10-7, Chrome, Firefox, Safari (OS X), as well as Android tablets and phones, along with IOS6 tablets and phones (iPhone & iPad). The Microsoft Surface tablet has also been tested.
There are many features to choose from. Have a look at the demos and, more importantly, the docs and associated blog posts for more details.
Furthermore, there are many server-side examples that may be helpful during integration of this library into your app. See the server directory in the Github project. ASP.NET is one of the many examples.
I wish to have the following feature in my web application:
On the client side When I copy an image from anywhere (it gets loaded to the clipboard), now I wish to have a button on which when I click it should save the image at the server location at some path.
I am ok to use anything javascript, jquery, c# at server side code just need the implementation of the above feature.
Please help.
Thanks a lot in advance.
Vaibhav
Check out this question and answers to it: How does the paste image from clipboard functionality work in Gmail and Google Chrome 12+? .
I think the most difficult part is to get it working in all browsers. So if you need older browsers support you probably should use some flash solution like http://code.google.com/p/zeroclipboard/ .
To save it to server you need some controller's POST action (if using MVC) or webservice or aspx page if using webforms. After getting clipboard image with javascript you send it to the server using AJAX for example.
Would anyone offer tips, links, code snippets on how to browse to a file folder from within an ASP.NET 3.5 web application and list the folder contents within a ListView?
Regards,
Rey R. [neophyte web application developer]
I assume you mean at the client? In which case, using regular methods you are limited to the <input type="file"/> and whatever that does in your user's browser.
Beyond that, you need additional tools; for example, flash or Silverlight - which would allow access, but even that may be sand-boxed for security.
You certainly can't list the user's files from the server.
Upload Multiple Files in ASP.NET using jQuery
http://www.dotnetcurry.com/ShowArticle.aspx?ID=317