Search Results

Search found 4900 results on 196 pages for 'upload'.

Page 10/196 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Python Post Upload JPEG to Server?

    - by iJames
    It seems like this answer has been provided a bunch of times but in all of it, I'm still getting errors from the server and I'm sure it has to do with my code. I've tried HTTP, and HTTPConnection from httplib and both create quite different terminal outputs in terms of formatting/encoding so I'm not sure where the problem lies. Does anything stand out here? Or is there just a better way? Pieced together from an ancient article because I really needed to understand the basis of creating the post: http://code.activestate.com/recipes/146306-http-client-to-post-using-multipartform-data/ Note, the jpeg is supposed to be "unformatted". The pseudocode: boundary = "somerandomsetofchars" BOUNDARY = '--' + boundary CRLF = '\r\n' fields = [('aspecialkey','thevalueofthekey')] files = [('Image.Data','mypicture.jpg','/users/home/me/mypicture.jpg')] bodylines = [] for (key, value) in fields: bodylines.append(BOUNDARY) bodylines.append('Content-Disposition: form-data; name="%s"' % key) bodylines.append('') bodylines.append(value) for (key, filename, fileloc) in files: bodylines.append(BOUNDARY) bodylines.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, filename)) bodylines.append('Content-Type: %s' % self.get_content_type(fileloc)) bodylines.append('') bodylines.append(open(fileloc,'r').read()) bodylines.append(BOUNDARY + '--') bodylines.append('') #print bodylines content_type = 'multipart/form-data; boundary=%s' % BOUNDARY body = CRLF.join(bodylines) #conn = httplib.HTTP("www.ahost.com") # In both this and below, the file part was garbling the rest of the body?!? conn = httplib.HTTPConnection("www.ahost.com") conn.putrequest('POST', "/myuploadlocation/uploadimage") headers = { 'content-length': str(len(body)), 'Content-Type' : content_type, 'User-Agent' : 'myagent' } for headerkey in headers: conn.putheader(headerkey, headers[headerkey]) conn.endheaders() conn.send(body) response = conn.getresponse() result = response.read() responseheaders = response.getheaders() It's interesting in that the real code I've implemented seems to work and is getting back valid responses, but the problem it it's telling me that it can't find the image data. Maybe this is particular to the server, but I'm just trying to rule out that I'm not doing some thing exceptionally stupid here. Or perhaps there's other methodologies for doing this more efficiently. I've not tried poster yet because I want to make sure I'm formatting the POST correctly first. I figure I can upgrade to poster after it's working yes?

    Read the article

  • Cannot upload media via Wordpress uploader

    - by Justin Johnson
    This has to do with media uploading in Wordpress. Every time WP creates a folder for new uploads (it organizes uploads by year and month: yyyy/mm), it creates it with the "apache:apache' user and group, with full access to all (777 or drwxrwxrwx). However, after that, WP cannot create a folder within that folder (e.g.: mkdir 2011 succeeds, but mkdir 2011/01 fails). Also, uploads cannot be moved into these newly created folders even though the permissions are 777 (rwxrwxrwx). Once a month, I have to chown the newly created folders to be the same as user:group as the rest of the files. Once I do that, uploading works fine (which doesn't make sense to me The really frustrating part is that this problem doesn't exist in other WP installs on other domains on the same server. * I wasn't sure if this should be here or on serverfault. Edit: The containing directory /.../httpdocs/blog/wp-content/uploads has the correct ownership drwxrwxrwx 5 myuser psaserv 4096 Jun 3 18:38 uploads This is a Plesk/CentOS environment hosted by Media Temple (dv). I've written the following test script to simulate the problem <pre><?php $d = "d" . mt_rand(100, 500); var_dump( get_current_user(), $d, mkdir($d), chmod($d, 0777), mkdir("$d/$d"), chmod("$d/$d", 0777), fileowner($d), getmyuid() ); The script always creates the first directory mkdir($d) successfully. On domain A, where the WP problem is, it cannot create the nested directory mkdir("$d/$d"). However, on domain B, both directories are successfully created. I am running each script at /var/www/vhosts/domainA/httpdocs/tmp/t.php and /var/www/vhosts/domainB/httpdocs/tmp/t.php respectively I checked the permissions on tmp, httpdocs, and domain[AB] and they are the same for each path. The only thing that differs is the user.

    Read the article

  • Upload An Excel File in Classic ASP On Windows 2003 x64 Using Office 2010 Drivers

    - by alphadogg
    So, we are migrating an old web app from a 32-bit server to a newer 64-bit server. The app is basically a Classic ASP app. The pool is set to run in 64-bit and cannot be set to 32-bit due to other components. However, this breaks the old usage of Jet drivers and subsequent parsing of Excel files. After some research, I downloaded the 64-bit version of the new 2010 Office System Driver Beta and installed it. Presumably, this allows one to open and read Excel and CSV files. Here's the snippet of code that errors out. Think I followed the lean guidelines on the download page: Set con = Server.CreateObject("ADODB.Connection") con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.14.0;Data Source=" & strPath & ";Extended Properties=""Excel 14.0;""" con.Open Any ideas why? UPDATE: My apologies. I did forget the important part, the error message: ADODB.Connection error '800a0e7a' Provider cannot be found. It may not be properly installed. /vendor/importZipList2.asp, line 56 I have installed, and uninstalled/reinstalled twice.

    Read the article

  • Silverlight file upload - file is in use by another process (Excel, Word)

    - by walkor
    Hi, all. I have a problem with uploading of the file in Silverlight application. Here is a code sample. In case when this file is opened in other application (excel or word for example) it fails to open it, otherwise it's working fine. I'm using OpenFileDialog to choose the file and pass it to this function. private byte[] GetFileContent(FileInfo file) { var result = new byte[] {}; try { using (var fs = file.OpenRead()) { result = new byte[file.Length]; fs.Read(result, 0, (int)file.Length); } } catch (Exception e) { // File is in use } return result; } Is there any way i can access this file or should i just notify the user that the file is locked?

    Read the article

  • Export GridView to TXT, then upload file to server

    Basically what I want to do is export an array (or GridView) to a file called "getpathin.dat". That is easy, but the method I am using downloads the file to my computer, which is what I don't want. I want to write an array to either a PRE-EXISTING file that is on the server OR create a new file on the server in a folder, and this new file will contain either the array or the gridview, which I have stored in the array. i'll be doing this in... Visual Studio 2008/SQL Server using C#

    Read the article

  • asp code for upload data

    - by vicky
    hello everyone i have this code for uploading an excel file and save the data into database.I m not able to write the code for database entry. someone please help <% if (Request("FileName") <> "") Then Dim objUpload, lngLoop Response.Write(server.MapPath(".")) If Request.TotalBytes > 0 Then Set objUpload = New vbsUpload For lngLoop = 0 to objUpload.Files.Count - 1 'If accessing this page annonymously, 'the internet guest account must have 'write permission to the path below. objUpload.Files.Item(lngLoop).Save "D:\PrismUpdated\prism_latest\Prism\uploadxl\" Response.Write "File Uploaded" Next Dim FSYSObj, folderObj, process_folder process_folder = server.MapPath(".") & "\uploadxl" set FSYSObj = server.CreateObject("Scripting.FileSystemObject") set folderObj = FSYSObj.GetFolder(process_folder) set filCollection = folderObj.Files Dim SQLStr SQLStr = "INSERT ALL INTO TABLENAME " for each file in filCollection file_name = file.name path = folderObj & "\" & file_name Set objExcel_chk = CreateObject("Excel.Application") Set ws1 = objExcel_chk.Workbooks.Open(path).Sheets(1) row_cnt = 1 'for row_cnt = 6 to 7 ' if ws1.Cells(row_cnt,col_cnt).Value <> "" then ' col = col_cnt ' end if 'next While (ws1.Cells(row_cnt, 1).Value <> "") for col_cnt = 1 to 10 SQLStr = SQLStr & "VALUES('" & ws1.Cells(row_cnt, 1).Value & "')" next row_cnt = row_cnt + 1 WEnd 'objExcel_chk.Quit objExcel_chk.Workbooks.Close() set ws1 = nothing objExcel_chk.Quit Response.Write(SQLStr) 'set filobj = FSYSObj.GetFile (sub_fol_path & "\" & file_name) 'filobj.Delete next End if End If plz tell me how to save the following excel data to the oracle databse.any help would be appreciated

    Read the article

  • PHP FTP Upload thousands of files

    - by user275074
    Hi, I've written a small FTP class which I used to move files from a local server to a remote server. It does this by checking an array of local files with an array of files on the remote server. If the file exists on the remote server, it won't bother uploading it. The script works fine for small amounts of files, but I've noticed that the local server can have as many as 3000+ image files to transfer, this seems to cause the script to flop and only transfer a 100 or so. How can I modify the script to handle potentially thousands of image transfer files?

    Read the article

  • Nginx: check content-length before file upload takes place

    - by robw
    I'm trying to prevent users from uploading (accidentally or maliciously) very large files to my website. I have nginx max_client_body_size set to 4M, but if a file larger than this is uploaded, then it uploads the entire file before returning 413 (entity too large). I want to make nginx check the Content-Length header, so that it rejects the request before it's uploaded. Alternatively, a Rails solution would also be acceptable. Any help appreciated.

    Read the article

  • Ajax -jquery image upload to iFrame resize problem

    - by DMort59
    I'm modifiying an ajax like jquery image uploader from /www.atwebresults.com/php_ajax_image_upload/ to see image on screen in iframe. I need the image to come in at 100% so I can use jquery resize. filename=name&maxSize=9999999999&maxW=200&fullPath=http://localhost/nyb/uploads/&relPath=../uploads/&colorR=255&colorG=255&colorB=255&maxH=300"

    Read the article

  • Multiple file upload with preview

    - by sean717
    Hi, Is there any good control or plug-in for uploading multiple photos with preview? As far as I understand it is impossible to preview photo on local computer using just JavaScript. So it has to use Flash or Java. Thanks, also, I use ASP.NET.

    Read the article

  • ASP.NET Image Upload Parameter Not Valid. Exception

    - by pennylane
    Hi Guys, Im just trying to save a file to disk using a posted stream from jquery uploadify I'm also getting Parameter not valid. On adding to the error message so i can tell where it blew up in production im seeing it blow up on: var postedBitmap = new Bitmap(postedFileStream) any help would be most appreciated public string SaveImageFile(Stream postedFileStream, string fileDirectory, string fileName, int imageWidth, int imageHeight) { string result = ""; string fullFilePath = Path.Combine(fileDirectory, fileName); string exhelp = ""; if (!File.Exists(fullFilePath)) { try { using (var postedBitmap = new Bitmap(postedFileStream)) { exhelp += "got past bmp creation" + fullFilePath; using (var imageToSave = ImageHandler.ResizeImage(postedBitmap, imageWidth, imageHeight)) { exhelp += "got past resize"; if (!Directory.Exists(fileDirectory)) { Directory.CreateDirectory(fileDirectory); } result = "Success"; postedBitmap.Dispose(); imageToSave.Save(fullFilePath, GetImageFormatForFile(fileName)); } exhelp += "got past save"; } } catch (Exception ex) { result = "Save Image File Failed " + ex.Message + ex.StackTrace; Global.SendExceptionEmail("Save Image File Failed " + exhelp, ex); } } return result; }

    Read the article

  • posting form with file upload

    - by Jan
    I am having trouble with uploading a file when using jquery. I have the following HTML in a form. <fieldset> <ul> <li> <div class="field"><input size="35" type="file" name="formFile" id="formFile"/></div> </li> <li> <div class="field"><input size="35" type="text" name="formFileName" id="formFileName" /></div> </li> </ul> </fieldset> To post the data I am using $('#myForm').ajaxForm( When I post the data and the recieved data contains some javascript, the javascript is not recognised. I expected the javscriptcode to run when the data is recieved, but it happens to early. The results indicates that $ or jquery could not be found. If I remove the name attribute from the input type=file element, there are no errors, but that is not the correct solution. How could this happen?

    Read the article

  • Detecting file upload size on the client side?

    - by DisgruntledGoat
    I'm using PHP for file uploads. In the PHP manual it shows an example using a MAX_FILE_SIZE hidden field, saying that it will detect on the client side (i.e. the browser) whether the file is too large or not. I've just tried the example in Firefox, Chrome and IE and it doesn't work. The file is always uploaded, even if it is way larger than the specified hidden field. Incidentally, if the file is larger than MAX_FILE_SIZE then calling move_uploaded_file doesn't work, so it seems the variable is having an effect server-side, but not client-side.

    Read the article

  • Upload files from website

    - by Andrew
    All I want to do is allow the user to browse through their folders to look for a file, select it and then press submit which saves the file to my server as well as the path to the saved file. How would someone do this? (Some sort of tutorial website would help a lot)

    Read the article

  • jQuery ajax form and Zend_Form file upload

    - by Sinisa Valentic
    If i submit my ajax form from jQuery, and do print_r($_FILES); i get a list of files uploaded, but if i do something like this $add_form->sound_file->isUploaded(); or $params = $this->_getAllParams(); print_r($params); i don't get my file in zend parametars, and i don't get it uploaded!? Mayb the problem is with he context beng ajax?!

    Read the article

  • Image upload - Return URL

    - by Qmal
    Hello I build a script that does image uploading and resizing and it all works well, but how can I get the URL from image afterwards? I don't want my Image Source in HTML be like "../img/cat/1.png/" I want it to be like "http://MyIP/img/cat/1.png" I understand that I can just make a variable like $myHost = "http://blabla.com"; and add strip the ".." at the beginning but then it's not so good if I want to use it on other site because I need to replace this all the time. Maybe there is any other way?

    Read the article

  • Java - Display % of upload done

    - by tr-raziel
    I have a java applet for uploading files to server. I want to display the % of data sent but when I use ObjectOutputStream.write() it just writes to the buffer, does not wait until the data has actually been sent. How can I achieve this. Perhaps I need to use thread synchronization or something. Any clues would be most helpful. This is the code I'm using right now: try{ for(File file : ficheiros){ FileInputStream stream = new FileInputStream (file); int bytesRead1 = 0;; int off1 = 0; int len1 = 100000; if(file.length() < 100000) len1 = new Long(file.length()).intValue(); byte[] bytes1 = new byte[len1]; while (off1 < file.length()) { bytes1 = new byte[len1]; if((file.length() - off1) < len1){ len1 = (new Long(file.length()).intValue() - off1); bytes1 = new byte[len1]; } if((bytesRead1 = stream.read(bytes1)) != -1){ //I want this to block until all data has been sent outputToServlet.write(bytes1, 0, bytesRead1 ); System.out.println("off1: " + off1); off1 = off1 + len1; outputToServlet.flush(); } sent += len1; if(sent>totalLength) sent = (int)totalLength; updateFeedback(sent,totalLength,false);//calls method to display % } updateFeedback(-1,-1,true); } }catch(Exception e){ e.printStackTrace(); } Thanks

    Read the article

  • i get error when i try to upload a file?

    - by getaway
    I keep getting an error:Notice: Undefined index: on line 35 line 35: $handle = new Upload($_FILES['my_field']); this is my input field <input type="file" size="32" name="my_field" value="" /> I do not understand this error, thanks!!! EDIT: <form name="upload" id="upload" enctype="multipart/form-data" method="post" action="actions/upload.php" /> <p><input type="file" size="32" name="my_field" value="" /></p> <p class="button"><input type="hidden" name="action" value="image" /> <br> <input style="margin-left:224px;" type="submit" name="submit" value="upload" />

    Read the article

  • Creando un File Upload

    - by jaullo
    Para iniciar hablaremos un poco sobre el control File Upload, de esta forma daremos una idea general de que es y como trabaja. El File Upload es un control de asp.net que permite que los usuarios seleccionen un archivo de cualquier ubicación en el equipo y lo suban a un directorio predeterminado a traves de una página asp.net. En principio este control esta limitado para no permitir subir archivos de mas de 4 MB. Sin embargo, desde el webconfig de nuestra aplicacón podremos cambiar ese valor, ya sea para aumentarlo o bien para disminuirlo. Nuestro ejemplo, se enfocará en crear un webcontrol que permita seleccionar un archivo y guardarlo, asi que empecemos. Lo primero será agregar a nuestra página un webcontrol que llamaremos Upload.ascx Posteriormente en nuestro webcontrol, agregamos el siguiente código: <table style="width: 100%">         <tr>             <td colspan="3">             <div align="center">                  <asp:Label ID="Label1" runat="server" Text="File Upload"></asp:Label>              </div>             </td>                    </tr>         <tr>             <td style="width: 456px" rowspan="2">                                                             &nbsp;</td>             <td style="width: 386px">                                <div align="center">                         <asp:FileUpload ID="FileUpload1" runat="server" Height="24px" Width="243px" />                         <span id="Span1" runat="server" />                            </div>                      </td>             <td rowspan="2">                                                             </td>         </tr>         <tr>             <td style="width: 386px">                 <div align="center">                      <asp:ImageButton Id="btnupload" runat="server" OnClick="btnupload_Click"                     ImageUrl="~/Styles/img/upload.png" style="text-align: center" />           </div>                  </td>         </tr>         <tr>             <td colspan="3">                 &nbsp;</td>         </tr>     </table>  De esta forma nuestro control deberá verse algo así   Por último en el code behin de nuestro control agregamos el código a nuestro boton, el cual será el encargado de leer el archivo que se encuentra en el File Upload y guardarlo en la ruta especificada.  Protected Sub btnupload_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnupload.Click         If FileUpload1.HasFile Then             Dim fileExt As String             fileExt = System.IO.Path.GetExtension(FileUpload1.FileName)             If (fileExt = ".exe") Then                 Label1.Text = "You can´t upload .exe file!"             Else                 Try                     FileUpload1.SaveAs(decrpath & _                        FileUpload1.FileName)                     Label1.Text = "File name: " & _                       FileUpload1.PostedFile.FileName & "<br>" & _                       "File Size: " & _                       FileUpload1.PostedFile.ContentLength & " kb<br>" & _                       "Content type: " & _                       FileUpload1.PostedFile.ContentType                 Catch ex As Exception                     Label1.Text = "ERROR: " & ex.Message.ToString()                 End Try             End If         Else             Label1.Text = "You have not specified a file!"         End If            End Sub   Como vemos en el código anterior tambien hemos agregado otros elementos los cuales nos dirán el nombre del archivo, el tipo de contenido y el tamaño en kb una vez que el archivo ha sido súbido al servidor. Por último deben tomar en cuenta que decrpath es la ruta en donde será subido el archivo, la cual deben variar a su gusto.

    Read the article

  • php image upload library

    - by Tchalvak
    I'm looking to NOT reinvent the wheel with an image upload system in php. Is there a good standalone library that allows for: Creating the system for uploading, renaming, and perhaps resizing images. Creating the front-end, html and/or javascript for the form upload parts of image upload. I've found a lot of image gallery systems, but no promising standalone system & ui libraries, ready for insertion into custom php.

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >