Question : upload file with php

i have a .xls file which i want to upload with some other input text.
i have tried but gives error.
actually i want to upload file first and then want to read their content.
i have code to read that file but it has problem in uploading file and move to folder named "upload"

here are my code


form code

 
1:
2:
3:
4:
5:
6:
<form action="import.php" method="POST" enctype="multipart/form-data">
File code: <input type="text" name="filecode" size="15"><br /><br />

Choose a Excel file (.xls) to upload: <input type="file" name="file" id="file" /><br /><br />
<input type="submit" value="Submit" />
</form>


import.php


 
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
<?php

if ((($_FILES["file"]["type"] == "xls") && ($_FILES["file"]["size"] < 20000))
  {



  if ($_FILES["file"]["error"] > 0)
    

	{
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "<br />";
    echo "Type: " . $_FILES["file"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

    if (file_exists("upload/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "upload/" . $_FILES["file"]["name"]);
      echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
      }
   }



  }

else
  {
  echo "Invalid file";
  }


$file=$_POST['file'];
$filecode=$_POST['filecode'];
?>


now in line 43, 44
will used for further action

Answer : upload file with php

There is -drawAtPoint: method in UIImage, if I understand the question.

If you have a UIView and need to set an image as a background, this code will help:

UIColor* bKColor = [[UIColor alloc] initWithPatternImage[UIImage imageNamed: @"MyBkgnd.png"]];
self.view.backgroundColor = bkColor;
[bkColor release];

If you need to draw something in a view, you can use drawInRect: method.
In the view .m file you usually have:
- (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        // Initialization code
    }
    return self;
}

- (void)drawRect:(CGRect)rect {
    // Drawing code
}

In the initWithFrame you can initialize the image and in drawInRect draw it.
For example so:
- (void)drawRect:(CGRect)rect {
        CGContextRef context = UIGraphicsGetCurrentContext();
        UIImage *myImage = [UIImage imageNamed:@"anImage.jpg"];
        CGPoint imagePoint = CGPointMake(10, 10);
        [myImage drawAtPoint:imagePoint];
        [myImage release];
}

Do you see the following line: [myImage drawAtPoint:imagePoint]; ?
it draws the image at point 10, 10.

I can recommend you this tutorial:
iPhone SDK: Learning About Touch Events & Basic Game Animation
http://mobile.tutsplus.com/tutorials/iphone/iphone-sdk-learning-about-touch-events-basic-game-animation/
Random Solutions  
 
programming4us programming4us