Click here to Skip to main content
15,889,867 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionFullCalendar button or click in day to add new event Pin
Member 1490896413-Oct-20 6:48
Member 1490896413-Oct-20 6:48 
QuestionRe: FullCalendar button or click in day to add new event Pin
ZurdoDev13-Oct-20 9:09
professionalZurdoDev13-Oct-20 9:09 
QuestionPDF to Images for encryption Pin
Member 105489775-Oct-20 4:30
Member 105489775-Oct-20 4:30 
AnswerRe: PDF to Images for encryption Pin
F-ES Sitecore6-Oct-20 0:07
professionalF-ES Sitecore6-Oct-20 0:07 
GeneralRe: PDF to Images for encryption Pin
Member 105489776-Oct-20 3:21
Member 105489776-Oct-20 3:21 
GeneralRe: PDF to Images for encryption Pin
F-ES Sitecore6-Oct-20 5:26
professionalF-ES Sitecore6-Oct-20 5:26 
GeneralRe: PDF to Images for encryption Pin
Member 105489776-Oct-20 5:57
Member 105489776-Oct-20 5:57 
GeneralRe: PDF to Images for encryption Pin
Member 105489776-Oct-20 6:00
Member 105489776-Oct-20 6:00 
GeneralRe: PDF to Images for encryption Pin
F-ES Sitecore6-Oct-20 6:08
professionalF-ES Sitecore6-Oct-20 6:08 
GeneralRe: PDF to Images for encryption Pin
Member 105489776-Oct-20 6:52
Member 105489776-Oct-20 6:52 
GeneralRe: PDF to Images for encryption Pin
F-ES Sitecore6-Oct-20 10:45
professionalF-ES Sitecore6-Oct-20 10:45 
GeneralRe: PDF to Images for encryption Pin
Member 105489777-Oct-20 7:00
Member 105489777-Oct-20 7:00 
GeneralRe: PDF to Images for encryption Pin
Member 105489776-Oct-20 3:22
Member 105489776-Oct-20 3:22 
QuestionDynamically added controls effecting other controls Pin
Member 149556174-Oct-20 11:22
Member 149556174-Oct-20 11:22 
AnswerRe: Dynamically added controls effecting other controls Pin
Richard Deeming5-Oct-20 2:55
mveRichard Deeming5-Oct-20 2:55 
GeneralRe: Dynamically added controls effecting other controls Pin
Member 149416716-Oct-20 1:16
Member 149416716-Oct-20 1:16 
Questiontrying to get some measurement data to ASP from Microsoft SQL? Pin
auting824-Oct-20 11:07
auting824-Oct-20 11:07 
AnswerRe: trying to get some measurement data to ASP from Microsoft SQL? Pin
Richard Deeming5-Oct-20 2:53
mveRichard Deeming5-Oct-20 2:53 
QuestionComplex View Model with Nested Item List / ModelState Pin
Guillermo Perez18-Sep-20 15:49
Guillermo Perez18-Sep-20 15:49 
AnswerRe: Complex View Model with Nested Item List / ModelState Pin
Richard Deeming27-Sep-20 22:21
mveRichard Deeming27-Sep-20 22:21 
QuestionFireFox Upload Images Pin
Member 105489774-Sep-20 6:23
Member 105489774-Sep-20 6:23 
AnswerRe: FireFox Upload Images Pin
Richard Deeming6-Sep-20 23:09
mveRichard Deeming6-Sep-20 23:09 
GeneralRe: FireFox Upload Images Pin
Member 1054897717-Sep-20 5:31
Member 1054897717-Sep-20 5:31 
My upload function code.

I did find a solution below you'll notice I force all upload files to be placed in the end user's C:\Temp folder. I also convert pdf files to an image before the encryption.


if (!String.IsNullOrEmpty(btnBrowse.FileName.ToString()))
{
    // --------------------------------------------------------------------
    // --------------------------------------------------------------------
    // in order to encrypt pdf first convert pdf to image. save and encrypt image.
    // --------------------------------------------------------------------
    if (fileExt == ".pdf")
    {
        pdfToJpg = @"c:\temp\" + btnBrowse.FileName.ToString().ToLower();
        jpgOut = System.IO.Path.GetFileNameWithoutExtension(btnBrowse.FileName.ToString().ToLower());
        jpgOut = @"c:\temp\" + jpgOut + ".jpg";
        success = Utilities.Pdf2Jpg(pdfToJpg, jpgOut);
        if (!success)
        {
            hdnFieldAlert.Value = "error; ERROR! File Not Converted.;Document Upload";
            return;
        }
        imagePath = jpgOut;
        savePath = appPath + saveDir + System.IO.Path.GetFileNameWithoutExtension(btnBrowse.FileName.ToString().ToLower()) + ".jpg";
    }
    // --------------------------------------------------------------------
    // --------------------------------------------------------------------

    sqlCmd = new SqlCommand("select legaldocurl from [dbo].[refugee] where [aregnum] = @clientNum", sqlCon);
    sqlCmd.Parameters.Add("@clientNum", SqlDbType.VarChar).Value = oARegNum;
    sqlCon.Open();
    SqlDataReader dr = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection);
    if (dr.Read() && !String.IsNullOrEmpty(dr["legaldocurl"].ToString()))
    {
        prevUpload = dr["legaldocurl"].ToString();
        prevUploadFile = appPath + saveDir + prevUpload;
        if (File.Exists(prevUploadFile)) File.Delete(prevUploadFile);
        if (File.Exists(savePath)) File.Delete(savePath);
    }
    // --------------------------------------------------------------------------
    // due to security reasons firefox does not return file location
    // to circumvent this - upload files must be placed in the c:\temp folder.
    // --------------------------------------------------------------------------
    string jpgFile = System.IO.Path.GetFileNameWithoutExtension(imagePath) + ".jpg";
    fileToEncrypt = imagePath;
    img = System.Drawing.Image.FromFile(fileToEncrypt);
    Utilities.Encrypt(img, savePath);
    img.Dispose();
    sqlCon.Close();
    sqlCmd = new SqlCommand("update [dbo].[refugee] set legaldocurl = @imgPath where [aregnum] = @clientNum", sqlCon);
    sqlCmd.Parameters.Add("@imgPath", SqlDbType.VarChar).Value = jpgFile;
    sqlCmd.Parameters.Add("@clientNum", SqlDbType.VarChar).Value = oARegNum;
    sqlCon.Open();
    sqlCmd.ExecuteNonQuery();
    sqlCon.Close();
    // --------------------------------------------------------------------------------
    // reload form with newly uploaded image
    // --------------------------------------------------------------------------------
    refugeeSelectByRecordId();

GeneralRe: FireFox Upload Images Pin
Richard Deeming17-Sep-20 9:06
mveRichard Deeming17-Sep-20 9:06 
GeneralRe: FireFox Upload Images Pin
Member 1054897718-Sep-20 5:48
Member 1054897718-Sep-20 5:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.