Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'common.php';
- Spec::it('should be able to upload => test_1');
- function test_1() {
- if (!empty($_FILES) && isset($_FILES['file']['tmp_name'])) {
- if (move_uploaded_file($_FILES['file']['tmp_name'], dirname(__FILE__).DS.'uploaded_file')) {
- return SUCCESS;
- }
- }
- }
- Spec::it('Should be able to rename upload file => test_2');
- function test_2() {
- $file = dirname(__FILE__).DS.'uploaded_file';
- $newname = dirname(__FILE__).DS.'new_file';
- if (rename($file, $newname)) {
- return SUCCESS;
- }
- }
- Spec::it('Should be able to remove a file after renamed => test_3');
- function test_3() {
- $file = dirname(__FILE__).DS.'new_file';
- if (unlink($file))
- return SUCCESS;
- }
- Spec::it("is not quite sure => test_4");
- function test_4() {
- return UNSURE;
- }
- Spec::run();
- ?>
- <form method="post" enctype="multipart/form-data">
- <input type="file" name="file">
- <input type="submit>
- </form>
Add Comment
Please, Sign In to add comment