Reputation: 23
I have a form as:<form action="test.php" method="post" name="testForm">
And I have validations of image upload in another file "upload.php" which has some code as:
if (in_array($_FILES['myfile']['type'], $types)) {
if(filesize($_FILES['myfile']['tmp_name']) < $max_size) {
$destination_path = getcwd().DIRECTORY_SEPARATOR."images".DIRECTORY_SEPARATOR;
So is there any way by which I can call the upload.php file without altering test.php file from form action attribute and perform my image upload validations.
Upvotes: 1
Views: 94
Reputation: 51
For the record, it would actually be better to use a jquery function which would submit the form to upload.php and then to test.php.
Upvotes: 1
Reputation: 6159
If you can alter the HTML code of your form, you could post to upload.php instead of test.php and then repost from upload.php to test.php (using CURL, for example)
Upvotes: 0
Reputation: 704
you could use
include('upload.php');
OR
by using copy of the function into test.php
Upvotes: 1
Reputation: 7868
If I get you right there are many ways. I recommend reading a bit in the manual:
Upvotes: 0