Hello,
How to image save without using FileUpload Control in c# asp.net?
I have a simple imagebox and I want to image save of this image box, in to the path or folder.
I am trying this jquery code for upload image.
Fileupload.prototype.change = function (e) {
if (e.target.files === undefined) e.target.files = e.target && e.target.value ? [{ name: e.target.value.replace(/^.+\\/, '')}] : []
if (e.target.files.length === 0) return
this.$hidden.val('')
this.$hidden.attr('name', '')
this.$input.attr('name', this.name)
var file = e.target.files[0]
if (this.$preview.length > 0 && (typeof file.type !== "undefined" ? file.type.match('image.*') : file.name.match(/\.(gif|png|jpe?g)$/i)) && typeof FileReader !== "undefined") {
var reader = new FileReader()
var preview = this.$preview
var element = this.$element
reader.onload = function (re) {
var $img = $('<img>').attr('src', re.target.result)
e.target.files[0].result = re.target.result
element.find('.fileinput-filename').text(file.name)
if (preview.css('max-height') != 'none') $img.css('max-height', parseInt(preview.css('max-height'), 10) - parseInt(preview.css('padding-top'), 10) - parseInt(preview.css('padding-bottom'), 10) - parseInt(preview.css('border-top'), 10) - parseInt(preview.css('border-bottom'), 10))
preview.html($img)
element.addClass('fileinput-exists').removeClass('fileinput-new')
element.trigger('change.bs.fileinput', e.target.files)
$('#HFLogoPath').val(file.name);
}
reader.readAsDataURL(file)
} else {
this.$element.find('.fileinput-filename').text(file.name)
this.$preview.text(file.name)
this.$element.addClass('fileinput-exists').removeClass('fileinput-new')
this.$element.trigger('change.bs.fileinput')
}
},
but my image did not save into the my server.mappath.
Please help me.
Thanks in Advance.
Ankit Agarwal
Website Application Developer