Search Results

Search found 72370 results on 2895 pages for 'file moving'.

Page 42/2895 | < Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >

  • Crossdomain file edit

    - by Misiur
    Hi there. I need to know, where from is my script used (it's for sale, and i don't want any thiefs). I want to write on my server in file, IP of user, domain where from script has been runned, date, etc. I've tried fopen, fwrite, but is_file_writable returned that it isn't. File CHmods are 777, it parent catalog has too 777 chmods. Now i'm trying something like that: <?php $file = 'http://www.misiur.com/security/seal.txt'; $data = date("Y-m-d H:i:s"); $ip = $_SERVER['REMOTE_ADDR']; $svr = $_SERVER['SERVER_NAME']; $str = "[$data] Loaded by $ip at $svr\r\n"; $current = file_get_contents($file); $current .= $str; file_put_contents($file, $current); ?> However - nothing happens. What i've got to do?

    Read the article

  • Increase file upload size limit in iis6

    - by JustFoo
    Is there any other place besides the metabase.xml file where the file upload size can be modified? I am currently running a staging server with IIS6 and it is setup to allow uploading of files up to 20mb. This works perfectly fine. I have a new production server where I am trying to setup this same available size limit. So I edited the metabase.xml file and set it to 20971520. Then I restarted IIS and that didn't work. So I then restarted the entire server, that also didn't work. I can upload files around 2mb so it is definitely allowing file sizes larger then the standard 200kb default size. I try uploading a 5mb file and my upload.aspx page completely crashes. Is it possible there is something else I need to configure? The production server is located on a server farm, could there be some limits set on there end? Thanks

    Read the article

  • Rename image file on upload php

    - by blasteralfred
    Hi, I have a form which uploads and re sizes image. The html file file submits data to a php file. The script is as follows; Index.html <form action="resizer.php" method="post" enctype="multipart/form-data"> Image: <input type="file" name="file" /> <input type="submit" name="submit" value="upload" /> </form> Resizer.php <?php require_once('imageresizer.class.php'); $imagename = "myimagename"; //Path To Upload Directory $dirpath = "uploaded/"; //MAX WIDTH AND HEIGHT OF IMAGE $max_height = 100; $max_width = 100; //Create Image Control Object - Parameters(file name, file tmp name, file type, directory path) $resizer = new ImageResizer($_FILES['file']['name'],$_FILES['file']['tmp_name'],$dirpath); //RESIZE IMAGE - Parameteres(max height, max width) $resizer->resizeImage($max_height,$max_width); //Display Image $resizer->showResizedImage(); ?> imageresizer.class.php <?php class ImageResizer{ public $file_name; public $tmp_name; public $dir_path; //Set variables public function __construct($file_name,$tmp_name,$dir_path){ $this->file_name = $file_name; $this->tmp_name = $tmp_name; $this->dir_path = $dir_path; $this->getImageInfo(); $this->moveImage(); } //Move the uploaded image to the new directory and rename public function moveImage(){ if(!is_dir($this->dir_path)){ mkdir($this->dir_path,0777,true); } if(move_uploaded_file($this->tmp_name,$this->dir_path.'_'.$this->file_name)){ $this->setFileName($this->dir_path.'_'.$this->file_name); } } //Define the new filename public function setFileName($file_name){ $this->file_name = $file_name; return $this->file_name; } //Resize the image function with new max height and width public function resizeImage($max_height,$max_width){ $this->max_height = $max_height; $this->max_width = $max_width; if($this->height > $this->width){ $ratio = $this->height / $this->max_height; $new_height = $this->max_height; $new_width = ($this->width / $ratio); } elseif($this->height < $this->width){ $ratio = ($this->width / $this->max_width); $new_width = $this->max_width; $new_height = ($this->height / $ratio); } else{ $new_width = $this->max_width; $new_height = $this->max_height; } $thumb = imagecreatetruecolor($new_width, $new_height); switch($this->file_type){ case 1: $image = imagecreatefromgif($this->file_name); break; case 2: $image = imagecreatefromjpeg($this->file_name); break; case 3: $image = imagecreatefrompng($this->file_name); break; case 4: $image = imagecreatefromwbmp($this->file_name); } imagecopyresampled($thumb, $image, 0, 0, 0, 0, $new_width, $new_height, $this->width, $this->height); switch($this->file_type){ case 1: imagegif($thumb,$this->file_name); break; case 2: imagejpeg($thumb,$this->file_name,100); break; case 3: imagepng($thumb,$this->file_name,0); break; case 4: imagewbmp($thumb,$this->file_name); } imagedestroy($image); imagedestroy($thumb); } public function getImageInfo(){ list($width, $height, $type) = getimagesize($this->tmp_name); $this->width = $width; $this->height = $height; $this->file_type = $type; } public function showResizedImage(){ echo "<img src='".$this->file_name." />"; } public function onSuccess(){ header("location: index.php"); } } ?> Everything is working well. The image will be uploaded in it's original filename and extension with a "_" prefix. But i want to rename the image to "myimagename" on upload, which is a variable in "Resizer.php". How can i make this possible?? Thanks in advance :) blasteralfred

    Read the article

  • Paint java GUI component to image file

    - by Simon
    Let's say I have JButton test = new JButton("Test Button"); and I want to draw the button into an image object and save it to a file. I tried this: BufferedImage b = new BufferedImage(500, 500, BufferedImage.TYPE_INT_ARGB); test.paint(b.createGraphics()); File output = new File("C:\\screenie.png"); try { ImageIO.write(b, "png", output); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } This code produced an empty 500x500 PNG-file. Does anyone know how I can draw the GUI component to an image file?

    Read the article

  • Opening a file from a pack URI in WPF

    - by cptmorgan
    Hi All, I am looking to open a .csv file from the application pack to do some unit testing. So what I would really love is some analog to File.ReadAllText(string path) which is instead X.ReadAllText(Uri uri). I haven't as yet been able to find this. Does anyone know if it is possible to read text / bytes (don't mind which) from a file in the pack without compiling this file to disk first? Oh and btw, File.ReadAllText(@"pack://application:,,,/SpreadSheetEngine/Tests/Example.csv") didn't work for me.. Thanks in advance.. Gav

    Read the article

  • mmap() for large file I/O?

    - by Boatzart
    I'm creating a utility in C++ to be run on Linux which can convert videos to a proprietary format. The video frames are very large (up to 16 megapixels), and we need to be able to seek directly to exact frame numbers, so our file format uses libz to compress each frame individually, and append the compressed data onto a file. Once all frames are finished being written, a journal which includes meta data for each frame (including their file offsets and sizes) is written to the end of the file. I'm currently using ifstream and ofstream to do the file i/o, but I am looking to optimize as much as possible. I've heard that mmap() can increase performance in a lot of cases, and I'm wondering if mine is one of them. Our files will be in the tens to hundreds of gigabytes, and although writing will always be done sequentially, random access reads should be done in constant time. Any thoughts as to whether I should investigate this further, and if so does anyone have any tips for things to look out for? Thanks!

    Read the article

  • Attaching HTML file as email in VB 6.0

    - by Shax
    Hi, I am trying to attach an html file file to email using Visual Basic 6.0. when the cursor is comes on Open strFile For Binary Access Read As #hFile line it gives error "Error encoding file - Bad file name or number". Please all your help and support would be highly appreciated. Dim handleFile As Integer Dim strValue As String Dim lEventCtr As Long handleFile = FreeFile Open strFile For Binary Access Read As #handleFile Do While Not EOF(hFile) ' read & Base 64 encode a line of characters strValue = Input(57, #handleFile) SendCommand EncodeBase64String(strValue) & vbCrLf ' DoEvents (occasionally) lEventCtr = lEventCtr + 1 If lEventCtr Mod 50 = 0 Then DoEvents Loop Close #handleFile Exit Sub File_Error: Close #handleFile m_ErrorDesc = "Error encoding file - " & Err.Description Err.Raise Err.Number, Err.Source, m_ErrorDesc End Sub

    Read the article

  • Specific 'boot file' definition

    - by Jazz
    Hey, I have been given a general explanation of how a computer boots up. However a very loose definition to the term 'boot file' was given. Could someone explain 'boot file' to me in a very simple but concise manner? I have read about the POST, the clearing of registers, BIOS in the CMOS, etc. What I understand is that the boot file is different to the boot program. the boot program gets the system ready to accept an OS while the boot file contains some of the parameters by which the system will operate. The boot program is stored on ROM and the boot file isnt? cheers, jazz

    Read the article

  • Recognizing file - Python

    - by Francisco Aleixo
    Ok, so the title may trick you a bit, and I'm sorry for that but didn't find a better title. This question might be a bit hard to understand so I'll try my best. I have no idea how this works or if it is even possible but what I want to do is for example create a file type (lets imagine .test (in which a random file name would be random.test)). Now before I continue, its obviously easy to do this using for example: filename = "random.test" file = open(filename, 'w') file.write("some text here") But now what I would like to know is if it is possible to write the file .test so if I set it to open with a wxPython program, it recognizes it and for example opens up a Message Dialog automatically. I'm sorry if I'm being vague and in case you don't understand, let me know so I can try my best to explain you.

    Read the article

  • How to code a batch file to copy and rename the most recently dated file?

    - by david.murtagh.keltie.com
    I'm trying to code a batch file to copy only the most recently dated file in a given folder to another directory on the local machine, and simultaneously rename it as it does. I've found a very similar question here http://stackoverflow.com/questions/97371/batch-script-to-copy-newest-file and have managed to cobble together the below code from other forums too, but have hit a brick wall as it only results in the batch file itself being copied to the destination folder. It doesn't matter to me where the batch file itself sits in order for this to run. The source folder is C:! BATCH and the destination folder is C:\DROP The code is below, apologies if this is a glaringly obvious answer but it's literally the first foray into coding batch files for me... Thanks! @echo off setLocal EnableDelayedExpansion pushd C:\! BATCH for /f "tokens=* delims= " %%G in ('dir/b/od') do (set newest=%%G) copy "!newest!" C:\DROP\ PAUSE

    Read the article

  • Best way to choose a random file from a directory in a shell script

    - by jhs
    What is the best way to choose a random file from a directory in a shell script? Here is my solution in Bash but I would be very interested for a more portable (non-GNU) version for use on Unix proper. dir='some/directory' file=`/bin/ls -1 "$dir" | sort --random-sort | head -1` path=`readlink --canonicalize "$dir/$file"` # Converts to full path echo "The randomly-selected file is: $path" Anybody have any other ideas? Edit: lhunath makes a good point about parsing ls. I guess it comes down to whether you want to be portable or not. If you have the GNU findutils and coreutils then you can do: find "$dir" -maxdepth 1 -mindepth 1 -type f -print0 \ | sort --zero-terminated --random-sort \ | sed 's/\d000.*//g/' Whew, that was fun! Also it matches my question better since I said "random file". Honsetly though, these days it's hard to imagine a Unix system deployed out there having GNU installed but not Perl 5.

    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

  • How to use application config file in C#?

    - by badpanda
    I am trying to use a config file in my C# console application. I created the file within the project by going New -- Application Configuration File, and naming it myProjectName.config. My config file looks like this: <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="SSDirectory" value="D:\Documents and Settings\****\MyDocuments\****" /> </appSettings> </configuration> The code to access it looks like this: private FileValidateUtil() { sSDirFilePath = ConfigurationSettings.AppSettings["SSDirectory"]; if (sSDirFilePath == null) Console.WriteLine("config file not reading in."); } Can anyone lend a hint as to why this is not working? (I am getting the error message.) Thanks!! badPanda

    Read the article

  • Need to get the uploaded file to my local PC

    - by Suhail
    Hi, I have created a test form which will ask users to enter a name and upload the image file: <html lang="en"> <head> <title>Testing image upload</title> </head> <body> <form action="/services/upload" method="POST" enctype="multipart/form-data"> File Description: <input name='fdesc' type='text'><br> File name: <input type="file" name="fname"><br> <div><input type="submit"></div> </form> </body> </html> i need to get the file uploaded by the user and store it on my local PC. can this be done in python ? please let me know.

    Read the article

  • Java how to copy part of a file

    - by user3479074
    I have to read a file and depending of the content of the last lines, I have to copy most of its content into a new file. Unfortunately I didn't found a way to copy first n lines or chars of a file in java. The only way I found, is copying the file using nio FileChannels where I can specifiy the length in bytes. However, therefore I would need to know how many bytes the stuff I read needed in the source-file. Does anyone know a solution for one of these problems?

    Read the article

  • Unknown symbols when I read file

    - by Sergey Gavruk
    I read file, but in the end of file i get unknown symbols: int main() { char *buffer, ch; int i = 0, size; FILE *fp = fopen("file.txt", "r"); if(!fp){ printf("File not found!\n"); exit(1); } fseek(fp, 0, SEEK_END); size = ftell(fp); printf("%d\n", size); fseek(fp, 0, SEEK_SET); buffer = malloc(size * sizeof(*buffer)); while(((ch = fgetc(fp)) != NULL) && (i <= size)){ buffer[i++] = ch; } printf(buffer); fclose(fp); free(buffer); getch(); return 0; }

    Read the article

  • saving file name from html form input

    - by user343934
    I am working on python and biopython right now. I have a file upload form and whatever file is uploaded suppose(abc.fasta) then i want to pass same name in execute (abc.fasta) function parameter and display function parameter (abc.aln). Workflow goes like this. ----If submit is not true then display only header and form part --- if submit is true then call execute() and get file name from form input --- Then display the save file result in the same page. File name is same as input. My raw code is here -- http://pastebin.com/FPUgZSSe Any suggestions, changes and algorithm is appreciated Thanks

    Read the article

  • Reading file data during form's clean method

    - by Dominic Rodger
    So, I'm working on implementing the answer to my previous question. Here's my model: class Talk(models.Model): title = models.CharField(max_length=200) mp3 = models.FileField(upload_to = u'talks/', max_length=200) Here's my form: class TalkForm(forms.ModelForm): def clean(self): super(TalkForm, self).clean() cleaned_data = self.cleaned_data if u'mp3' in self.files: from mutagen.mp3 import MP3 if hasattr(self.files['mp3'], 'temporary_file_path'): audio = MP3(self.files['mp3'].temporary_file_path()) else: # What goes here? audio = None # setting to None for now ... return cleaned_data class Meta: model = Talk Mutagen needs file-like objects - the first case (where the uploaded file is larger than the size of file handled in memory) works fine, but I don't know how to handle InMemoryUploadedFile that I get otherwise. I've tried: # TypeError (coercing to Unicode: need string or buffer, InMemoryUploadedFile found) audio = MP3(self.files['mp3']) # TypeError (coercing to Unicode: need string or buffer, cStringIO.StringO found) audio = MP3(self.files['mp3'].file) # Hangs seemingly indefinitely audio = MP3(self.files['mp3'].file.read()) Is there something wrong with mutagen, or am I doing it wrong?

    Read the article

  • Read a file with 2048 bytes

    - by Suresh S
    Guys i have a file which has only one line. The file has no encoding it is a simple text file with single line. For every 2048 byte in a line , there is new record of 151 byte (totally 13*151 byte = 1945 records + 85 byte empty space). similarly for the next 2048 bytes. What is the best file i/o to use? i am thinking of reading 2048 bytes from file and storing it in an array . while (offset < fileLength &&(numRead=in.read(recordChunks, offset,alength)) >= 0) { } how can i get from the read statement only 2048 bytes at a time . i am getting IndexOutofBoundException.

    Read the article

  • Instant file sharing between users in PHP

    - by Skyfe
    Hi there, Working on a rather complex system in which users can directly exchange files with eachother from the website. However is any of these things possible: EITHER * Have another user download a file which is still being uploaded by another user ( in progress ) OR * Make a user automaticly ( instant ) download a file from another users PC through our website OR * Make a user automaticly (instant) download a file from our server ( so it's directly downloaded to the users pc and the progress shown on our website of the download progress, without the normal internet explorer dialog downloading the file or firefox ). Thank you very much in advanced, Best Regards, Webcodez.net. UPDATE: an example would be MSN's file sharing but then through a website instead of application.

    Read the article

  • Delete file after sharing via intent.

    - by Matt
    I'm trying to delete a temporary file after sharing it via android's Intent.ACTION_SEND feature. Right now I am starting the activity for a result and in OnActivityResult, I am deleting the file. Unfortunately this only works if I am debugging it with a breakpoint, but when I let it run freely and say, email the file, the email has no attachment. I think what is happening is my activity is deleting the file before it had been emailed. What I don't get is why, shouldn't onActivityResult only be called AFTER the other activity is finished? I have also tried deleting the file in onResume, but no luck. Is there a better way to do this?

    Read the article

  • How can I convert a specific .cs file into either a .bat or a .exe file?

    - by user2974969
    I am trying to convert around 1,900 .txp files (a proprietary Sony image format) to .png. However, the .exe program I am using to convert these files only allows me to select one file at a time. I am running Windows 7. There's a TXP.CS file in the 'src' folder of the program, so I figured that if I was able to turn that into an executable file, I'd be able to use it to mass convert these files to PNG. However, whenever I try to convert the file using csc.exe, I get the CS0246 error (the type or namespace name 'Tools' could not be found. Are you missing a using directive or an assembly reference?). I can't use Microsoft Visual Studio right now, so I'm hoping someone can walk me through this, or maybe convert the file to either a .bat or an .exe for me. Thank you. TXP.CS

    Read the article

  • C: Reading file with a starting point

    - by Shinka
    A simple question but I can't find the answer in my book. I want to read a binary file to seed a random number generator, but I don't want to seed my generator with the same seed each time I call the function, so I will need to keep a variable for my position in the file (not a problem) and I would need to know how to read a file starting a specific point in the file (no idea how). The code: void rng_init(RNG* rng) { // ... FILE *input = fopen("random.bin", "rb"); unsigned int seed[32]; fread(seed, sizeof(unsigned int), 32, input); // seed 'rng'... fclose(input); }

    Read the article

  • Accessing a file (for writing) from a JBoss Web Service

    - by Andreas Grech
    Let's say I have this structure of my Java Web Application: TheProject -- [Web Pages] -- -- abc.txt -- -- index.jsp -- [Source Packages] -- -- [wservices] -- -- -- WS.java WS.java is my Web Service, which is situated in a wservices package. Now from this service, I need to access the abc.txt file and write to it. These are my urls: http://127.0.0.1:8080/TheProject/WS <- the webservice http://127.0.0.1:8080/TheProject/abc.txt <- the file I want to access To read the file, I tried with getResourceAsStream and I was successful in reading from it. But now I also want to write to this file, and I tried such a method but failed. Is there a way I can get access to the abc.txt file from WS.java and be able to successfully read from and write to it?

    Read the article

  • Problem with access to file

    - by phenevo
    Hi, I have winforms application and it has reference to library MyLibrary. MyLibrary has method: string[] GiveMeNamesOfAirports() { string[] lines= File.ReadLines("airports.txt"); foreach(string line in lines) ... } And when I run my Winforms application: I get error: file couldn't be find. I was trying other function: string[] lines = File.ReadAllLines(Path.Combine(System.Environment.CurrentDirectory, "airports.txt")); string[] lines = File.ReadAllLines(Path.Combine(Assembly.GetExecutingAssembly().Location, "airports.txt")); string[] lines = File.ReadAllLines(Path.Combine(Assembly.GetAssembly(typeof(Airport)).Location, "airports.txt"));

    Read the article

< Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >